 Chromium Code Reviews
 Chromium Code Reviews Issue 2771183002:
  [wasm][asm.js] Fix and enable several asm.js tests with the new parser.  (Closed)
    
  
    Issue 2771183002:
  [wasm][asm.js] Fix and enable several asm.js tests with the new parser.  (Closed) 
  | Index: src/wasm/wasm-module-builder.cc | 
| diff --git a/src/wasm/wasm-module-builder.cc b/src/wasm/wasm-module-builder.cc | 
| index b1b859ba42cbd9c0d63b2c0950869760a7f8b42b..548c2d0b672ed8581e4e0d0b0795e52fe0406d0f 100644 | 
| --- a/src/wasm/wasm-module-builder.cc | 
| +++ b/src/wasm/wasm-module-builder.cc | 
| @@ -191,6 +191,10 @@ void WasmFunctionBuilder::StashCode(std::vector<byte>* dst, size_t position) { | 
| return; | 
| } | 
| size_t len = body_.size() - position; | 
| + if (len == 0) { | 
| + // TODO(bradnelson): Figure out why the memcpy crashes if len == 0. | 
| 
Michael Starzinger
2017/03/24 11:56:05
It is not the memcpy that crashes but the accessor
 
bradnelson
2017/03/28 04:34:31
Done.
 | 
| + return; | 
| + } | 
| dst->resize(len); | 
| memcpy(dst->data(), &body_[position], len); | 
| body_.resize(position); |