New issue
Advanced search Search tips

Issue 644720 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Implement grow_memory (0x39), or fail more gracefully

Project Member Reported by mscales@chromium.org, Sep 7 2016

Issue description

Version: 55.0.2853.0 canary (64-bit)
OS: Mac OSX

# What steps will reproduce the problem?
Execute the grow_memory instruction. With WASM enabled in flags, try:

var bytes = new Uint8Array([
  0x00, 0x61, 0x73, 0x6d, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x74, 0x79, 0x70, 0x65,
  0x05, 0x01, 0x40, 0x00, 0x01, 0x01, 0x08, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
  0x6f, 0x6e, 0x03, 0x02, 0x00, 0x00, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79,
  0x03, 0x01, 0x0a, 0x01, 0x06, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x0d, 0x02,
  0x00, 0x04, 0x67, 0x72, 0x6f, 0x77, 0x01, 0x04, 0x63, 0x75, 0x72, 0x72, 0x04,
  0x63, 0x6f, 0x64, 0x65, 0x09, 0x02, 0x04, 0x00, 0x10, 0x01, 0x39, 0x02, 0x00,
  0x3b
]);

var module = Wasm.instantiateModule(bytes);

console.log(module.exports.grow(), ',', module.exports.memory.byteLength);

# What is the expected output?
1, 131072

# What do you see instead?
In 53.0.2785.89 (64-bit): 0, 65536
In 55.0.2853.0 canary (64-bit): tab crashes (crash/b4b2f46e00000000)

The spec says that the number returned should be the number of pages previously allocated, or -1 on failure. Here it seems like the allocation has failed (because the memory size is still 64k), but 0 is returned instead.

https://github.com/WebAssembly/design/blob/master/AstSemantics.md#resizing

(P.S. if reporting unimplemented parts of such an early stage spec isn't useful, just let me know :D)
 
Status: Available (was: Untriaged)
Status: Fixed (was: Available)

Sign in to add a comment