RESOLVED FIXED 159543
padStart/padEnd with Infinity produces unexpected result
https://bugs.webkit.org/show_bug.cgi?id=159543
Summary padStart/padEnd with Infinity produces unexpected result
Joseph Pecoraro
Reported 2016-07-07 21:38:46 PDT
Summary: padStart/padEnd with Infinity produces unexpected result Test: >>> "foo".padStart(Infinity, "x") "nullfoo" >>> "foo".padEnd(Infinity, "x") "foonull" Expected: "Error: Out of memory" for a string that would be > Max String Size (JSString::MaxLength is std::numeric_limits<int32_t>::max()). Spec: <https://tc39.github.io/ecma262/#sec-string.prototype.padend> <https://tc39.github.io/ecma262/#sec-string.prototype.padstart> Note the spec does special case the empty fill string, so that can be handled even if the maxLength is Infinity: > 1. Let O be ? RequireObjectCoercible(this value). > 2. Let S be ? ToString(O). > 3. Let intMaxLength be ? ToLength(maxLength). > 4. Let stringLength be the number of elements in S. > 5. If intMaxLength is not greater than stringLength, return S. > 6. If fillString is undefined, let filler be a String consisting solely of the code unit 0x0020 (SPACE). > 7. Else, let filler be ? ToString(fillString). > 8. If filler is the empty String, return S. > ...
Attachments
[PATCH] Proposed Fix (30.32 KB, patch)
2016-07-07 21:43 PDT, Joseph Pecoraro
no flags
[PATCH] Proposed Fix (29.36 KB, patch)
2016-07-07 21:44 PDT, Joseph Pecoraro
benjamin: review+
[PATCH] For Landing (30.13 KB, patch)
2016-07-07 22:26 PDT, Joseph Pecoraro
no flags
Joseph Pecoraro
Comment 1 2016-07-07 21:43:01 PDT
Created attachment 283105 [details] [PATCH] Proposed Fix
Joseph Pecoraro
Comment 2 2016-07-07 21:44:52 PDT
Created attachment 283106 [details] [PATCH] Proposed Fix Fixed double ChangeLog.
Joseph Pecoraro
Comment 3 2016-07-07 22:26:13 PDT
Created attachment 283109 [details] [PATCH] For Landing Some improvements to the builtins that Ben saw.
WebKit Commit Bot
Comment 4 2016-07-07 23:26:13 PDT
Comment on attachment 283109 [details] [PATCH] For Landing Clearing flags on attachment: 283109 Committed r202966: <http://trac.webkit.org/changeset/202966>
Note You need to log in before you can comment on or make changes to this bug.