Changeset 56092 in webkit
- Timestamp:
- Mar 16, 2010 4:14:31 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r56085 r56092 1 2010-03-16 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Oliver Hunt, Darin Adler. 4 5 Bug 36083 - REGRESSION (r55772-r55834): Crash in JavaScriptCore RegExp code on PowerPC 6 7 The problem is a bug in our port of PCRE - that a read may take place from the first character in an 8 empty string. For the time being, revert to using a valid pointer in the data segment rather than 9 an invalid non-null pointer into the zero-page for the empty string's data pointer. A better fix for 10 this will be to remove PCRE. 11 12 * runtime/UStringImpl.cpp: 13 (JSC::UStringImpl::empty): 14 1 15 2010-03-16 Darin Adler <darin@apple.com> 2 16 -
trunk/JavaScriptCore/runtime/UStringImpl.cpp
r55943 r56092 65 65 UStringImpl* UStringImpl::empty() 66 66 { 67 // A non-null pointer at an invalid address (in page zero) so that if it were to be accessed we 68 // should catch the error with fault (however it should be impossible to access, since length is zero). 69 static const UChar* invalidNonNullUCharPtr = reinterpret_cast<UChar*>(static_cast<intptr_t>(1)); 70 DEFINE_STATIC_LOCAL(UStringImpl, emptyString, (invalidNonNullUCharPtr, 0, ConstructStaticString)); 67 // FIXME: This works around a bug in our port of PCRE, that a regular expression 68 // run on the empty string may still perform a read from the first element, and 69 // as such we need this to be a valid pointer. No code should ever be reading 70 // from a zero length string, so this should be able to be a non-null pointer 71 // into the zero-page. 72 // Replace this with 'reinterpret_cast<UChar*>(static_cast<intptr_t>(1))' once 73 // PCRE goes away. 74 static UChar emptyUCharData = 0; 75 DEFINE_STATIC_LOCAL(UStringImpl, emptyString, (&emptyUCharData, 0, ConstructStaticString)); 71 76 return &emptyString; 72 77 }
Note: See TracChangeset
for help on using the changeset viewer.