Changeset 238531 in webkit
- Timestamp:
- Nov 26, 2018, 4:47:48 PM (8 years ago)
- Location:
- branches/safari-606-branch
- Files:
-
- 3 added
- 6 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/big-wasm-memory-grow-no-max.js (added)
-
JSTests/stress/big-wasm-memory-grow.js (added)
-
JSTests/stress/big-wasm-memory.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/ArrayBuffer.cpp (modified) (7 diffs)
-
Source/JavaScriptCore/runtime/ArrayBuffer.h (modified) (2 diffs)
-
Source/JavaScriptCore/wasm/WasmMemory.cpp (modified) (4 diffs)
-
Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-606-branch/JSTests/ChangeLog
r238272 r238531 1 2018-11-26 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r238326. rdar://problem/46259215 4 5 All users of ArrayBuffer should agree on the same max size 6 https://bugs.webkit.org/show_bug.cgi?id=191771 7 8 Reviewed by Mark Lam. 9 10 JSTests: 11 12 * stress/big-wasm-memory-grow-no-max.js: Added. 13 (foo): 14 (catch): 15 * stress/big-wasm-memory-grow.js: Added. 16 (foo): 17 (catch): 18 * stress/big-wasm-memory.js: Added. 19 (foo): 20 (catch): 21 22 Source/JavaScriptCore: 23 24 Array buffers cannot be larger than 0x7fffffff, because otherwise loading typedArray.length in the DFG/FTL would produce 25 a uint32 or would require a signedness check, neither of which sounds reasonable. It's better to just bound their max size 26 instead. 27 28 * runtime/ArrayBuffer.cpp: 29 (JSC::ArrayBufferContents::ArrayBufferContents): 30 (JSC::ArrayBufferContents::tryAllocate): 31 (JSC::ArrayBufferContents::transferTo): 32 (JSC::ArrayBufferContents::copyTo): 33 (JSC::ArrayBufferContents::shareWith): 34 * runtime/ArrayBuffer.h: 35 * wasm/WasmMemory.cpp: 36 (JSC::Wasm::Memory::tryCreate): 37 (JSC::Wasm::Memory::grow): 38 * wasm/WasmPageCount.h: 39 40 41 42 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238326 268f45cc-cd09-0410-ab3c-d52691b4dbfc 43 44 2018-11-16 Filip Pizlo <fpizlo@apple.com> 45 46 All users of ArrayBuffer should agree on the same max size 47 https://bugs.webkit.org/show_bug.cgi?id=191771 48 49 Reviewed by Mark Lam. 50 51 * stress/big-wasm-memory-grow-no-max.js: Added. 52 (foo): 53 (catch): 54 * stress/big-wasm-memory-grow.js: Added. 55 (foo): 56 (catch): 57 * stress/big-wasm-memory.js: Added. 58 (foo): 59 (catch): 60 1 61 2018-11-15 Mark Lam <mark.lam@apple.com> 2 62 -
branches/safari-606-branch/Source/JavaScriptCore/ChangeLog
r238272 r238531 1 2018-11-26 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r238326. rdar://problem/46259215 4 5 All users of ArrayBuffer should agree on the same max size 6 https://bugs.webkit.org/show_bug.cgi?id=191771 7 8 Reviewed by Mark Lam. 9 10 JSTests: 11 12 * stress/big-wasm-memory-grow-no-max.js: Added. 13 (foo): 14 (catch): 15 * stress/big-wasm-memory-grow.js: Added. 16 (foo): 17 (catch): 18 * stress/big-wasm-memory.js: Added. 19 (foo): 20 (catch): 21 22 Source/JavaScriptCore: 23 24 Array buffers cannot be larger than 0x7fffffff, because otherwise loading typedArray.length in the DFG/FTL would produce 25 a uint32 or would require a signedness check, neither of which sounds reasonable. It's better to just bound their max size 26 instead. 27 28 * runtime/ArrayBuffer.cpp: 29 (JSC::ArrayBufferContents::ArrayBufferContents): 30 (JSC::ArrayBufferContents::tryAllocate): 31 (JSC::ArrayBufferContents::transferTo): 32 (JSC::ArrayBufferContents::copyTo): 33 (JSC::ArrayBufferContents::shareWith): 34 * runtime/ArrayBuffer.h: 35 * wasm/WasmMemory.cpp: 36 (JSC::Wasm::Memory::tryCreate): 37 (JSC::Wasm::Memory::grow): 38 * wasm/WasmPageCount.h: 39 40 41 42 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238326 268f45cc-cd09-0410-ab3c-d52691b4dbfc 43 44 2018-11-16 Filip Pizlo <fpizlo@apple.com> 45 46 All users of ArrayBuffer should agree on the same max size 47 https://bugs.webkit.org/show_bug.cgi?id=191771 48 49 Reviewed by Mark Lam. 50 51 Array buffers cannot be larger than 0x7fffffff, because otherwise loading typedArray.length in the DFG/FTL would produce 52 a uint32 or would require a signedness check, neither of which sounds reasonable. It's better to just bound their max size 53 instead. 54 55 * runtime/ArrayBuffer.cpp: 56 (JSC::ArrayBufferContents::ArrayBufferContents): 57 (JSC::ArrayBufferContents::tryAllocate): 58 (JSC::ArrayBufferContents::transferTo): 59 (JSC::ArrayBufferContents::copyTo): 60 (JSC::ArrayBufferContents::shareWith): 61 * runtime/ArrayBuffer.h: 62 * wasm/WasmMemory.cpp: 63 (JSC::Wasm::Memory::tryCreate): 64 (JSC::Wasm::Memory::grow): 65 * wasm/WasmPageCount.h: 66 1 67 2018-11-15 Mark Lam <mark.lam@apple.com> 2 68 -
branches/safari-606-branch/Source/JavaScriptCore/runtime/ArrayBuffer.cpp
r233122 r238531 1 1 /* 2 * Copyright (C) 2009-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2009-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 60 60 , m_sizeInBytes(sizeInBytes) 61 61 { 62 RELEASE_ASSERT(m_sizeInBytes <= MAX_ARRAY_BUFFER_SIZE); 62 63 m_destructor = WTFMove(destructor); 63 64 } … … 98 99 if (numElements) { 99 100 unsigned totalSize = numElements * elementByteSize; 100 if (totalSize / numElements != elementByteSize 101 || totalSize > static_cast<unsigned>(std::numeric_limits<int32_t>::max())) { 101 if (totalSize / numElements != elementByteSize || totalSize > MAX_ARRAY_BUFFER_SIZE) { 102 102 reset(); 103 103 return; … … 117 117 118 118 m_sizeInBytes = numElements * elementByteSize; 119 RELEASE_ASSERT(m_sizeInBytes <= MAX_ARRAY_BUFFER_SIZE); 119 120 m_destructor = [] (void* p) { Gigacage::free(Gigacage::Primitive, p); }; 120 121 } … … 131 132 other.m_data = m_data; 132 133 other.m_sizeInBytes = m_sizeInBytes; 134 RELEASE_ASSERT(other.m_sizeInBytes <= MAX_ARRAY_BUFFER_SIZE); 133 135 other.m_destructor = WTFMove(m_destructor); 134 136 other.m_shared = m_shared; … … 144 146 memcpy(other.m_data.get(), m_data.get(), m_sizeInBytes); 145 147 other.m_sizeInBytes = m_sizeInBytes; 148 RELEASE_ASSERT(other.m_sizeInBytes <= MAX_ARRAY_BUFFER_SIZE); 146 149 } 147 150 … … 154 157 other.m_data = m_data; 155 158 other.m_sizeInBytes = m_sizeInBytes; 159 RELEASE_ASSERT(other.m_sizeInBytes <= MAX_ARRAY_BUFFER_SIZE); 156 160 } 157 161 -
branches/safari-606-branch/Source/JavaScriptCore/runtime/ArrayBuffer.h
r230828 r238531 1 1 /* 2 * Copyright (C) 2009-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2009-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 namespace JSC { 38 38 39 #define MAX_ARRAY_BUFFER_SIZE 0x7fffffffu 40 39 41 class VM; 40 42 class ArrayBuffer; -
branches/safari-606-branch/Source/JavaScriptCore/wasm/WasmMemory.cpp
r232613 r238531 1 1 /* 2 * Copyright (C) 2016-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 283 283 const size_t maximumBytes = maximum ? maximum.bytes() : 0; 284 284 285 RELEASE_ASSERT(initialBytes <= MAX_ARRAY_BUFFER_SIZE); 286 285 287 if (maximum && !maximumBytes) { 286 288 // User specified a zero maximum, initial size must also be zero. … … 373 375 374 376 const Wasm::PageCount newPageCount = oldPageCount + delta; 375 if (!newPageCount) 377 // FIXME: Creating a wasm memory that is bigger than the ArrayBuffer limit but smaller than the spec limit should throw 378 // OOME not RangeError 379 // https://bugs.webkit.org/show_bug.cgi?id=191776 380 if (!newPageCount || !newPageCount.isValid() || newPageCount.bytes() >= MAX_ARRAY_BUFFER_SIZE) 376 381 return makeUnexpected(GrowFailReason::InvalidGrowSize); 377 382 … … 396 401 397 402 size_t desiredSize = newPageCount.bytes(); 403 RELEASE_ASSERT(desiredSize <= MAX_ARRAY_BUFFER_SIZE); 398 404 RELEASE_ASSERT(desiredSize > m_size); 399 405 size_t extraBytes = desiredSize - m_size; -
branches/safari-606-branch/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp
r233122 r238531 71 71 uint32_t size = toNonWrappingUint32(exec, minSizeValue); 72 72 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 73 if (!Wasm::PageCount::isValid(size)) 73 // FIXME: Creating a wasm memory that is bigger than the ArrayBuffer limit but smaller than the spec limit should throw 74 // OOME not RangeError 75 // https://bugs.webkit.org/show_bug.cgi?id=191776 76 if (!Wasm::PageCount::isValid(size) || Wasm::PageCount(size).bytes() >= MAX_ARRAY_BUFFER_SIZE) 74 77 return JSValue::encode(throwException(exec, throwScope, createRangeError(exec, "WebAssembly.Memory 'initial' page count is too large"_s))); 75 78 initialPageCount = Wasm::PageCount(size);
Note:
See TracChangeset
for help on using the changeset viewer.