binaryen.js icon indicating copy to clipboard operation
binaryen.js copied to clipboard

addActiveElementSegment out of bound

Open niu2x opened this issue 6 months ago • 1 comments

by

console.log("e.table", e.table, data.length)
console.log("table", binaryen.getTableInfo(this.module.getTable(e.table)))

output

e.table 0 185325
table { name: '0', module: '', base: '', initial: 185326, max: 185326 }

we know table's capacity is 185326. data length is 185325.

then, call addActiveElementSegment

this.module.addActiveElementSegment(e.table, this.module.i32.const(0), data)

it is crash


RangeError: offset is out of bounds
    at Int32Array.set (<anonymous>)
    at H (file:///home/niu2x/project/wasm-knife/node_modules/binaryen/index.js:7:9932452)
    at file:///home/niu2x/project/wasm-knife/node_modules/binaryen/index.js:7:9980342
    at R (file:///home/niu2x/project/wasm-knife/node_modules/binaryen/index.js:7:9932359)
    at HA.I.addActiveElementSegment (file:///home/niu2x/project/wasm-knife/node_modules/binaryen/index.js:7:9980289)

niu2x avatar Aug 04 '24 09:08 niu2x