-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
I am running wizer on a large wasm file with 80390 data segments (I can provide it on request). The file output by wizer does preserve my data segments but the count value is truncated to 10000, resulting in a malformed wasm file according to tools like wasm-dis and wasm-opt since the naming section is still referring to the old indices.
Before:
0x11a8c | 09 c4 a6 05 | element section
0x11a90 | 01 | 1 count
0x11a91 | 00 | element table[None]
0x11a92 | 41 01 | i32_const value:1
0x11a94 | 0b | end
0x11a95 | e3 81 02 | 32995 items [indices]
... 32995 lines removed ...
0x26dd4 | 0c 03 | data count section
0x26dd6 | 86 f4 04 | data count 80390
0x26dd9 | 0a fa ef ca | code section
| 06
0x26dde | 95 f8 02 | 48149 count
After:
0x11a78 | 09 c4 a6 05 | element section
0x11a7c | 01 | 1 count
0x11a7d | 00 | element table[None]
0x11a7e | 41 01 | i32_const value:1
0x11a80 | 0b | end
0x11a81 | e3 81 02 | 32995 items [indices]
... 32995 lines removed ...
0x26dc0 | 0c 02 | data count section
0x26dc2 | 90 4e | data count 10000
0x26dc4 | 0a fa ef ca | code section
| 06
0x26dc9 | 95 f8 02 | 48149 count
Causing tools like wasm-dis to output this warning:
warning: data index out of bounds in name section: .rodata.10000 at index 10000
And wasm-opt to fail more explosively with this:
wasm-opt: /b/s/w/ir/cache/builder/emscripten-releases/binaryen/src/wasm/wasm.cpp:1833: void wasm::Module::updateDataSegmentsMap(): Assertion `dataSegmentsMap.size() == dataSegments.size()' failed.
Since the resulting file still contains up to this:
0x267d509 | 85 f4 04 0d | Naming { index: 80389, name: ".rodata.80389" }
| 2e 72 6f 64
| 61 74 61 2e
| 38 30 33 38
| 39
I guess there might be a bug that it doesn't rewrite the indices, but I would question why there is such a small limit to begin with.
Metadata
Metadata
Assignees
Labels
No labels