1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:05:07 +00:00
serenity/Userland/Libraries/LibJS/Tests/builtins/String
Nico Weber 1b944b4c41 LibJS: Fix substr() with negative arguments larger than string length
length_in_code_units() returns a size_t, which is 64-bit unsigned
in i686 builds. `size + (i32)int_length` hence produced a 64-bit
unsigned result, so a negative value would wrap around and become
a very large number.

As fix, just omit the cast -- we assign the result of max() to
a double anyways.

With this, all test262 tests in annexB/built-ins/String/prototype pass.
2022-01-14 11:12:24 +01:00
..
String.fromCharCode.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
String.fromCodePoint.js LibJS: Add the String.fromCodePoint() method 2021-06-16 10:29:10 +01:00
String.js LibJS: Report string properties using UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype-generic-functions.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
String.prototype.at.js LibJS: Implement String.prototype.at with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.charAt.js LibJS: Implement String.prototype.charAt with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.charCodeAt.js LibJS: Implement String.prototype.charCodeAt with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.codePointAt.js LibJS: Implement String.prototype.codePointAt with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.concat.js LibJS: Add UTF-16 tests to String.prototype methods that already work 2021-07-22 09:10:44 +02:00
String.prototype.endsWith.js LibJS: Implement String.prototype.endsWith with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.includes.js LibJS: Implement String.prototype.includes with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.indexOf.js LibJS: Implement String.prototype.indexOf with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
String.prototype.lastIndexOf.js LibJS: Implement String.prototype.lastIndexOf with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.localeCompare.js LibJS: Implement a naive String.prototype.localeCompare 2021-07-26 15:56:15 +01:00
String.prototype.match.js LibRegex: Allow Unicode escape sequences in capture group names 2021-08-19 23:49:25 +02:00
String.prototype.matchAll.js LibJS: Implement RegExp.prototype [ @@match ] with UTF-16 code units 2021-07-23 23:06:57 +01:00
String.prototype.padEnd.js LibJS: Implement StringPad abstract operation with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.padStart.js LibJS: Implement StringPad abstract operation with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.repeat.js LibJS: Add UTF-16 tests to String.prototype methods that already work 2021-07-22 09:10:44 +02:00
String.prototype.replace.js LibJS: Implement RegExp.prototype [ @@replace ] with UTF-16 code units 2021-07-23 23:06:57 +01:00
String.prototype.replaceAll.js LibJS: Implement RegExp.prototype [ @@replace ] with UTF-16 code units 2021-07-23 23:06:57 +01:00
String.prototype.search.js LibJS: Implement RegExp.prototype [ @@search ] with UTF-16 code units 2021-07-23 23:06:57 +01:00
String.prototype.slice.js LibJS: Implement String.prototype.slice with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.split.js LibJS: Implement RegExp.prototype [ @@split ] with UTF-16 code units 2021-07-23 23:06:57 +01:00
String.prototype.startsWith.js LibJS: Implement String.prototype.startsWith with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.substr.js LibJS: Fix substr() with negative arguments larger than string length 2022-01-14 11:12:24 +01:00
String.prototype.substring.js LibJS: Implement String.prototype.substring with UTF-16 code units 2021-07-22 09:10:44 +02:00
String.prototype.toLocaleLowerCase.js LibJS: Implement ECMA-402 String.prototype.toLocale{Lower,Upper}Case 2021-09-06 15:24:27 +01:00
String.prototype.toLocaleUpperCase.js LibJS: Implement ECMA-402 String.prototype.toLocale{Lower,Upper}Case 2021-09-06 15:24:27 +01:00
String.prototype.toLowerCase.js LibJS: Use special case folding for String.prototype.to{Lower,Upper}Case 2021-07-27 21:04:36 +01:00
String.prototype.toString.js LibJS: Add UTF-16 tests to String.prototype methods that already work 2021-07-22 09:10:44 +02:00
String.prototype.toUpperCase.js LibJS: Use special case folding for String.prototype.to{Lower,Upper}Case 2021-07-27 21:04:36 +01:00
String.prototype.trim.js LibJS: Add UTF-16 tests to String.prototype methods that already work 2021-07-22 09:10:44 +02:00
String.prototype.valueOf.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
String.raw.js LibJS: Rewrite String.raw() closer to the specification 2021-06-28 13:27:13 +01:00