• Enrico Bacis's avatar
    [wasm] Fix grow-memory on exported memory · 8ee06838
    Enrico Bacis authored
    The WASM spec maximum memory size is higher than internal V8 maximum object
    size. When a memory object grows above this limit (and only in that case), we
    should signal an error.
    
    This worked for not-exported memory; however when growing exported memory, the
    code was comparing the V8 memory limit with the maximum number of pages defined
    in the module, instead of the current number of pages + the number of new
    required pages. This lead to signaling errors even when growing exported memory
    below the V8 limit if the maximum number of pages specified in the module was
    higher than the V8 limit.
    
    GrowMemoryBuffer already checks that we do not grow a memory buffer past the
    maximum size specified as parameter, so we can pass it the minimum between the
    the V8 limit and the maximum number of pages specified in the module.
    
    This CL introduces a test in test/mjsunit/wasm/import-memory.js that triggers
    the problematic path and a patch to fix it.
    
    R=ahaas@chromium.org,clemensh@chromium.org,gdeepti@chromium.org
    
    Change-Id: I5a8da420418b394d61e1ba3cdf4408c3c09e61b6
    Reviewed-on: https://chromium-review.googlesource.com/600217Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
    Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
    Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
    Commit-Queue: Enrico Bacis <enricobacis@google.com>
    Cr-Commit-Position: refs/heads/master@{#47395}
    8ee06838
Name
Last commit
Last update
..
OWNERS Loading commit data...
compilation-manager.cc Loading commit data...
compilation-manager.h Loading commit data...
decoder.h Loading commit data...
function-body-decoder-impl.h Loading commit data...
function-body-decoder.cc Loading commit data...
function-body-decoder.h Loading commit data...
leb-helper.h Loading commit data...
local-decl-encoder.cc Loading commit data...
local-decl-encoder.h Loading commit data...
module-compiler.cc Loading commit data...
module-compiler.h Loading commit data...
module-decoder.cc Loading commit data...
module-decoder.h Loading commit data...
signature-map.cc Loading commit data...
signature-map.h Loading commit data...
streaming-decoder.cc Loading commit data...
streaming-decoder.h Loading commit data...
wasm-api.cc Loading commit data...
wasm-api.h Loading commit data...
wasm-code-specialization.cc Loading commit data...
wasm-code-specialization.h Loading commit data...
wasm-debug.cc Loading commit data...
wasm-external-refs.cc Loading commit data...
wasm-external-refs.h Loading commit data...
wasm-interpreter.cc Loading commit data...
wasm-interpreter.h Loading commit data...
wasm-js.cc Loading commit data...
wasm-js.h Loading commit data...
wasm-limits.h Loading commit data...
wasm-module-builder.cc Loading commit data...
wasm-module-builder.h Loading commit data...
wasm-module.cc Loading commit data...
wasm-module.h Loading commit data...
wasm-objects.cc Loading commit data...
wasm-objects.h Loading commit data...
wasm-opcodes.cc Loading commit data...
wasm-opcodes.h Loading commit data...
wasm-result.cc Loading commit data...
wasm-result.h Loading commit data...
wasm-text.cc Loading commit data...
wasm-text.h Loading commit data...
wasm-value.h Loading commit data...