Commit 4754b211 authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[wasm][test] Avoid stack overflow that can happen with spread call to Array.push.

R=rossberg@chromium.org

Bug: 
Change-Id: I2401709b42106c7e325144b53be3c3b3d1ed16c7
Reviewed-on: https://chromium-review.googlesource.com/599874Reviewed-by: 's avatarAndreas Rossberg <rossberg@chromium.org>
Commit-Queue: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47127}
parent f9c4b7a2
......@@ -74,7 +74,7 @@ class Binary extends Array {
// Emit section length.
this.emit_u32v(section.length);
// Copy the temporary buffer.
this.push(...section);
for (var i = 0; i < section.length; i++) this.push(section[i]);
}
}
......@@ -197,8 +197,9 @@ class WasmModuleBuilder {
}
addType(type) {
// TODO: canonicalize types?
this.types.push(type);
var pl = type.params.length; // should have params
var rl = type.results.length; // should have results
return this.types.length - 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment