Changeset 242910 in webkit
- Timestamp:
- Mar 13, 2019 2:42:17 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r242841 r242910 1 2019-03-13 Dominik Infuehr <dinfuehr@igalia.com> 2 3 String overflow when using StringBuilder in JSC::createError 4 https://bugs.webkit.org/show_bug.cgi?id=194957 5 6 Reviewed by Mark Lam. 7 8 Add test string-overflow-createError-bulder.js that overflows 9 StringBuilder in notAFunctionSourceAppender. The second new test 10 string-overflow-createError-fit.js has an error message that doesn't 11 overflow, it still failed since the String's capacity can't be doubled. 12 Run test string-overflow-createError.js only in the default 13 configuration to reduce memory consumption when running the test 14 in all configurations on multiple CPUs in parallel. 15 16 * stress/string-overflow-createError-builder.js: Copied from JSTests/stress/string-overflow-createError.js. 17 (catch): 18 * stress/string-overflow-createError-fit.js: Copied from JSTests/stress/string-overflow-createError.js. 19 (catch): 20 * stress/string-overflow-createError.js: 21 1 22 2019-03-12 Yusuke Suzuki <ysuzuki@apple.com> 2 23 -
trunk/JSTests/stress/string-overflow-createError.js
r239560 r242910 1 1 //@ skip if $memoryLimited 2 //@ runDefault 2 3 var exception; 3 4 try { … … 9 10 } 10 11 12 // Creating the error message for the TypeError overflows 13 // the string and therefore an out-of-memory error is thrown. 11 14 if (exception != "Error: Out of memory") 12 15 throw "FAILED"; -
trunk/Source/JavaScriptCore/ChangeLog
r242902 r242910 1 2019-03-13 Dominik Infuehr <dinfuehr@igalia.com> 2 3 String overflow when using StringBuilder in JSC::createError 4 https://bugs.webkit.org/show_bug.cgi?id=194957 5 6 Reviewed by Mark Lam. 7 8 StringBuilder in notAFunctionSourceAppender didn't check 9 for overflows but just failed. 10 11 * runtime/ExceptionHelpers.cpp: 12 (JSC::notAFunctionSourceAppender): 13 1 14 2019-03-11 Yusuke Suzuki <ysuzuki@apple.com> 2 15 -
trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
r242596 r242910 194 194 if (!base) 195 195 return defaultApproximateSourceError(originalMessage, sourceText); 196 StringBuilder builder ;196 StringBuilder builder(StringBuilder::OverflowHandler::RecordOverflow); 197 197 builder.append(base); 198 198 builder.appendLiteral(" is not a function. (In '"); … … 210 210 builder.append(')'); 211 211 212 if (builder.hasOverflowed()) 213 return makeString("object is not a function."_s); 214 212 215 return builder.toString(); 213 216 } -
trunk/Source/WTF/ChangeLog
r242909 r242910 1 2019-03-13 Dominik Infuehr <dinfuehr@igalia.com> 2 3 String overflow when using StringBuilder in JSC::createError 4 https://bugs.webkit.org/show_bug.cgi?id=194957 5 6 Reviewed by Mark Lam. 7 8 When calculating the new capacity of a StringBuilder object, 9 use a limit of MaxLength instead of MaxLength+1. Allocating 10 a string of size MaxLength+1 always fails. This means that expanding 11 a StringBuilder only worked when the newly doubled capacity is less or 12 equal to MaxLength. 13 14 * wtf/text/StringBuilder.cpp: 15 1 16 2019-03-13 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/WTF/wtf/text/StringBuilder.cpp
r242360 r242910 35 35 namespace WTF { 36 36 37 static constexpr unsigned maxCapacity = String::MaxLength + 1;37 static constexpr unsigned maxCapacity = String::MaxLength; 38 38 39 39 static unsigned expandedCapacity(unsigned capacity, unsigned requiredLength)
Note: See TracChangeset
for help on using the changeset viewer.