Changeset 175243 in webkit
- Timestamp:
- Oct 27, 2014, 10:46:52 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r175241 r175243 1 2014-10-27 Mark Lam <mark.lam@apple.com> 2 3 Crash when attempting to perform array iteration on a non-array with numeric keys not initialized. 4 <https://webkit.org/b/137814> 5 6 Reviewed by Geoffrey Garen. 7 8 * js/array-length-shortening-expected.txt: Added. 9 * js/array-length-shortening.html: Added. 10 * js/for-of-crash-expected.txt: Added. 11 * js/for-of-crash.html: Added. 12 * js/script-tests/array-length-shortening.js: Added. 13 (testLengthShortening): 14 (denseInt32Elements): 15 (denseDoubleElements): 16 (denseObjectElements): 17 (holeyInt32Elements): 18 (holeyDoubleElements): 19 (holeyObjectElements): 20 (arrayStorageInt32Elements): 21 (arrayStorageDoubleElements): 22 (arrayStorageObjectElements): 23 (sparseInt32Elements): 24 (sparseDoubleElements): 25 (sparseObjectElements): 26 * js/script-tests/for-of-crash.js: Added. 27 (foo): 28 1 29 2014-10-27 Chris Fleizach <cfleizach@apple.com> 2 30 -
trunk/Source/JavaScriptCore/ChangeLog
r175240 r175243 1 2014-10-27 Mark Lam <mark.lam@apple.com> 2 3 Crash when attempting to perform array iteration on a non-array with numeric keys not initialized. 4 <https://webkit.org/b/137814> 5 6 Reviewed by Geoffrey Garen. 7 8 The arrayIteratorNextThunkGenerator() thunk was not checking for the case where 9 the butterfly may be NULL. This was the source of the crash, and is now fixed. 10 11 In addition, it is also not checking for the case where a property named "length" 12 may have been set on the iterated object. The thunk only checks the butterfly's 13 publicLength for its iteration operation. Array objects will work fine with this 14 because it always updates its butterfly's publicLength when its length changes. 15 In the case of iterable non-Array objects, the "length" property will require a 16 look up outside of the scope of this thunk. The fix is simply to limit the fast 17 case checks in this thunk to Array objects. 18 19 * jit/ThunkGenerators.cpp: 20 (JSC::arrayIteratorNextThunkGenerator): 21 1 22 2014-10-27 Mark Lam <mark.lam@apple.com> 2 23 -
trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp
r174996 r175243 1101 1101 jit.load8(Address(SpecializedThunkJIT::regT0, JSCell::indexingTypeOffset()), SpecializedThunkJIT::regT3); 1102 1102 jit.loadPtr(Address(SpecializedThunkJIT::regT0, JSObject::butterflyOffset()), SpecializedThunkJIT::regT2); 1103 1104 jit.and32(TrustedImm32(IndexingShapeMask), SpecializedThunkJIT::regT3); 1105 1103 Jump nullButterfly = jit.branchTestPtr(SpecializedThunkJIT::Zero, SpecializedThunkJIT::regT2); 1104 1106 1105 Jump notDone = jit.branch32(SpecializedThunkJIT::Below, SpecializedThunkJIT::regT1, Address(SpecializedThunkJIT::regT2, Butterfly::offsetOfPublicLength())); 1106 1107 nullButterfly.link(&jit); 1108 1107 1109 // Return the termination signal to indicate that we've finished 1108 1110 jit.move(TrustedImmPtr(vm->iterationTerminator.get()), SpecializedThunkJIT::regT0); … … 1123 1125 1124 1126 // So now we perform inline loads for int32, value/undecided, and double storage 1125 Jump undecidedStorage = jit.branch32(SpecializedThunkJIT::Equal, SpecializedThunkJIT::regT3, TrustedImm32( UndecidedShape));1126 Jump notContiguousStorage = jit.branch32(SpecializedThunkJIT::NotEqual, SpecializedThunkJIT::regT3, TrustedImm32( ContiguousShape));1127 Jump undecidedStorage = jit.branch32(SpecializedThunkJIT::Equal, SpecializedThunkJIT::regT3, TrustedImm32(ArrayWithUndecided)); 1128 Jump notContiguousStorage = jit.branch32(SpecializedThunkJIT::NotEqual, SpecializedThunkJIT::regT3, TrustedImm32(ArrayWithContiguous)); 1127 1129 1128 1130 undecidedStorage.link(&jit); … … 1152 1154 notContiguousStorage.link(&jit); 1153 1155 1154 Jump notInt32Storage = jit.branch32(SpecializedThunkJIT::NotEqual, SpecializedThunkJIT::regT3, TrustedImm32( Int32Shape));1156 Jump notInt32Storage = jit.branch32(SpecializedThunkJIT::NotEqual, SpecializedThunkJIT::regT3, TrustedImm32(ArrayWithInt32)); 1155 1157 jit.loadPtr(Address(SpecializedThunkJIT::regT0, JSObject::butterflyOffset()), SpecializedThunkJIT::regT2); 1156 1158 jit.load32(BaseIndex(SpecializedThunkJIT::regT2, SpecializedThunkJIT::regT1, SpecializedThunkJIT::TimesEight, JSValue::offsetOfPayload()), SpecializedThunkJIT::regT0); … … 1159 1161 notInt32Storage.link(&jit); 1160 1162 1161 jit.appendFailure(jit.branch32(SpecializedThunkJIT::NotEqual, SpecializedThunkJIT::regT3, TrustedImm32( DoubleShape)));1163 jit.appendFailure(jit.branch32(SpecializedThunkJIT::NotEqual, SpecializedThunkJIT::regT3, TrustedImm32(ArrayWithDouble))); 1162 1164 jit.loadPtr(Address(SpecializedThunkJIT::regT0, JSObject::butterflyOffset()), SpecializedThunkJIT::regT2); 1163 1165 jit.loadDouble(BaseIndex(SpecializedThunkJIT::regT2, SpecializedThunkJIT::regT1, SpecializedThunkJIT::TimesEight), SpecializedThunkJIT::fpRegT0);
Note:
See TracChangeset
for help on using the changeset viewer.