summaryrefslogtreecommitdiff
path: root/test/binary
Commit message (Collapse)AuthorAgeFilesLines
* Issue a nicer error message on wasm components. (#2515)Dan Gohman2024-12-062-0/+14
| | | | | | | | | | | | Decode just enough of the component binary format to recognize when the input is a component, and issue a dedicated error message for it. Before: 0000008: error: bad wasm file version: 0x1000d (expected 0x1) After: 0000008: error: wasm components are not yet supported in this tool
* Add support for the custom-page-sizes proposal (#2502)Keith Winstein2024-11-081-3/+3
| | | | This adds support in the binary/text parsers and writers, the validator and interpreter, and objdump (but not wasm2c).
* Harden against invalid alignment (#2411)Soni L.2024-08-091-2/+3
|
* Update testsuite and implement table64 (#2418)Sam Clegg2024-05-151-2/+2
| | | | | See https://github.com/WebAssembly/memory64/issues/51 Includes workaround for #2422
* Add support for new WASM_SEGMENT_FLAG_RETAIN segment flag (#2399)Yuta Saito2024-03-111-2/+6
| | | See https://github.com/llvm/llvm-project/pull/81539
* Handle zero local count in disassembly (#2359)Rod Vagg2024-01-031-0/+27
| | | | Previously: local[0..4294967295] Current: local[]
* Add support for new WASM_SYMBOL_ABS symbol flag (#2305)Sam Clegg2023-11-281-4/+12
| | | See https://github.com/llvm/llvm-project/pull/67493
* Implement custom section reading/writing (#2284)Diego Frias2023-09-152-0/+18
|
* memory64: when enabled, check offset range at validation-time (#2253)Keith Winstein2023-06-121-2/+2
| | | | | | | | | | | | | | | | * memory64: when enabled, offset range check is at validation-time Before memory64, the "offset" in a load/store expression was a u32, and we enforced this in the WastParser and BinaryReader. After memory64, the "offset" becomes a u64 syntactically, and the validator checks that it's <= UINT32_MAX for i32 memories. We hadn't been correctly allowing these very large offsets in the text format (even when memory64 was enabled and the memory was i64). (This change also eliminates the "memories" member in the BinaryReader. The BinaryReader no longer needs to keep track of the memories and their types to check well-formedness.)
* binary-reader.cc: detect more malformed modules (#2251)Keith Winstein2023-06-083-9/+5
|
* wasm-objdump: Include function names in "init functions" subsection (#2202)Sam Clegg2023-04-201-2/+2
|
* binary-reader.cc: expand max local count and fix error message (#2173)Keith Winstein2023-03-151-1/+2
| | | | | * binary-reader.cc: expand max local count and fix error message Fixes #1593
* Fix several issues found by fuzzing (#1931)20192022-09-172-0/+40
| | | | | Fixes #1922, fixes #1924, fixes #1929 Co-authored-by: Keith Winstein <keithw@cs.stanford.edu>
* Fix incorrect index usage in BinaryReaderIR::OnTableSymbol (#1976)Sam Clegg2022-08-311-2/+54
|
* Allow binary reader to skip function bodies. NFC (#1871)Sam Clegg2022-03-232-30/+4
| | | | | | | This is purely a performance optimization for wasm-objdump since it doesn't always need to decode function bodies. For a very large wasm file that I was testing this takes the time taken for `wasm-objdump -h` from 8.6s to 1.5s.
* Add initial support for code metadata (#1840)Yuri Iozzelli2022-02-258-0/+538
| | | | | | | | | | | | | | | | | | | | | See https://github.com/WebAssembly/tool-conventions/blob/main/CodeMetadata.md for the specification. In particular this pr implements the following: - Parsing code metadata sections in BinaryReader, providing appropriate callbacks that a BinaryReaderDelegate can implement: - BinaryReaderObjdump: show the sections in a human-readable form - BinaryReaderIr: add code metadata in the IR as expressions - Parsing code metadata annotations in text format, adding them in the IR like the BinaryReaderIR does - Writing the code metadata present in the IR in the proper sections when converting IR to binary - Support in wasm-decompiler for showing code metadata as comments in the pseudo-code All the features have corresponding tests. Support for code metadata is gated through the --enable-code-metadata feature. For reading/writing in the text format, --enable-annotations is also required. Missing features: Support for function-level code metadata (offset 0) Extensive validation in validator.cc (like making sure that all metadata instances are at the same code offset of an instruction)
* Added support for multi-memory in apply-names (#1810)Yuhan Deng2022-02-171-2/+2
|
* Fix size of segment in initialization error reporting (#1823)Sam Clegg2022-02-091-1/+0
| | | | | | | | | | | | | | | When data of element segment init fails we were reporting the size, but we were unconditionally calling `Drop` for active segments which meant they always get reported as zero sized in the error message. This mismatch was only showing up with bulk memory enabled (since without this we do a two phase initialization). The only test we have for this error message was using `--disable-bulk-memory`, but not for any good reason (most likely because of this very bug). Also restore the comment about why we sometimes need to do a two phase initialization for element and data segments. This comment was lost in PR #1330 but seem important since I don't think we have any tests for this older behaviour.
* Update testsuite (#1795)Sam Clegg2022-01-101-17/+0
| | | | Remove test/binary/bad-function-missing-end.txt which is now covered upstream: https://github.com/WebAssembly/spec/pull/1405
* Finish instruction renaming (#1792)Heejin Ahn2021-12-2016-16/+16
| | | | | | | | | | | | | This finishes #985. This - replaces the old names in the tests with the new names - drops support for the deprecated names - renames test files to match new instruction names I don't think dropping support for the old names will be a problem at this point. #985 says the old names are supported for convenience but we should remove those too at some point; that "some point" may have well arrived given that three years have passed. The lists of names updated are in #933, #1564, WebAssembly/spec#720.
* Remove check from binary-reader-interp.cc that the validator already ↵Sam Clegg2021-12-131-2/+2
| | | | | | | | | | catches. NFC (#1784) If you leave stuff on the stack at the end of an initializer expression use the same mechanims to report the error as we do for functions etc. In addition, improve such errors so its more obvious what is going on.
* Add test for function lacking END marker. NFC (#1775)Sam Clegg2021-12-071-0/+17
| | | I guess the spec tests don't include such a test.
* Remove separate OnEndFunc vs OnEndExpr. (#1756)Sam Clegg2021-11-052-8/+8
| | | | We already have EndFunctionBody, and this extra distinction doesn't seem like it is needed.
* Add support for target_features section (#1744)Sam Clegg2021-10-191-0/+28
|
* Support for import/export info in dylink section (#1741)Sam Clegg2021-10-191-0/+24
|
* Enable reference types by default (#1729)Sam Clegg2021-10-132-2/+4
| | | | | | | | | This features was finished earlier this year: https://github.com/WebAssembly/proposals/blob/master/finished-proposals.md One thing to note is that the version of the spec tests we currently have in third_party/testsuite doesn't have ref types merged yet so this change disables ref types when running some of those tests. This can be removed in a followup when we update the testsuite.
* Enable bulk memory by default (#1728)Sam Clegg2021-10-138-12/+3
| | | | | | | | | | | This features was finished earlier this year: https://github.com/WebAssembly/proposals/blob/master/finished-proposals.md One thing to note is that the version of the spec tests we currently have in third_party/testsuite doesn't have bulk memory merged yet so this change disables bulk memory when running some of those tests. This will be removed in a followup when we update the testsuite. Fixes: #1717
* Avoid writing DataCount section when it is not needed. (#1727)Sam Clegg2021-10-131-2/+0
| | | | | | | | | | | Without this change, when bulk memory is enabled, the DataCount is always written when then removed if it proves that its not needed by any instruction. However, if we know there are no data segments we can avoid writing it altogether. This happens to be more compact but I'm hoping to land this now in anticipation of enabled bulk memory by default. Once we do that we don't want all the `dump` tests to include the writing and truncating of the DataCount section in cases when there is no data.
* Fix ub access of 0-size vector in data segment (#1725)Ng Zhi An2021-10-121-0/+16
| | | | If the module has no memory, the we try to copy the passive data segment to memories[0], and memories is a size 0 vector, which is UB.
* SIMD is now phase 5, enable it by default (#1712)Ng Zhi An2021-09-201-10/+0
| | | | | * SIMD is now phase 5, enable it by default * Update test flags, rebase test, and docs
* Support new dylink custom section format (#1707)Sam Clegg2021-09-101-0/+37
| | | | | | | | This section is now based on sub-sections making it more extensible. See also: llvm change: https://reviews.llvm.org/D109595 binaryen change: https://github.com/WebAssembly/binaryen/pull/4141
* Support TLS symbol flag (#1706)Sam Clegg2021-09-091-2/+2
| | | See https://reviews.llvm.org/D109426
* [EH] Replace event with tag (#1678)Heejin Ahn2021-06-223-10/+10
| | | | | | | | | | | We recently decided to change 'event' to 'tag', and 'event section' to 'tag section', out of the rationale that the section contains a generalized tag that references a type, which may be used for something other than exceptions, and the name 'event' can be confusing in the web context. See - https://github.com/WebAssembly/exception-handling/issues/159#issuecomment-857910130 - https://github.com/WebAssembly/exception-handling/pull/161
* Fix reading of bad relocation type (#1672)Sam Clegg2021-05-281-0/+30
| | | Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30792
* objdump: add support for segments flags in the linking section (#1669)Sam Clegg2021-05-132-9/+9
|
* objdump: fix typo (#1614)Sam Clegg2021-03-021-1/+1
|
* Update rethrow depth handling and catch_all opcode (#1608)Asumu Takikawa2021-02-181-2/+2
| | | | | | | | | | | | | Give `catch_all` its own opcode: Previously `catch_all` shared an opcode with `else`, but the spec now allocates it the 0x19 opcode. Adjust rethrow depth semantics: Previously this had interpreted the rethrow depth argument as counting only catch blocks, but the spec has clarified that it should count all blocks (in a similar fashion as `br` and related instructions).
* Update exception handling support to current proposal (#1596)Asumu Takikawa2021-02-101-0/+23
| | | | | | | | | | This PR updates the support of exception handling to the latest proposal (that is compatible with future 2-phase exception handling) described in https://github.com/WebAssembly/exception-handling/pull/137 and https://github.com/WebAssembly/exception-handling/pull/143. * Adds back tagged `catch $e`, `catch_all`, and `rethrow N` from a previous version of wabt, but with updates to match the current spec (e.g., `catch_all` shares an opcode with `else`, `rethrow`'s depth indexes only catch blocks, etc). * Adds `unwind` and `delegate` instructions. * Removes `exnref` and `br_on_exn`. * Updates relevant tests. There are some details that could still change (e.g., maybe how `delegate`'s depth is validated), but I'd be happy to submit further PRs if the spec details change.
* Use stderr for all logging and error output (#1579)Sam Clegg2020-12-032-5/+5
| | | | I'm not sure why we were using stdout but the convention is normally to write all logging and error message to stderr.
* Update output from type to func type in binary writer and reader (#1570)Radu M2020-11-162-2/+2
| | | Signed-off-by: Radu M <root@radu.sh>
* Disallow "64-bit" flag if memory64 is disabled (#1547)Paweł Bylica2020-09-182-0/+23
| | | | Fixes regressions in binary reader introduced by the implementation of the memory64 extension: https://github.com/WebAssembly/wabt/pull/1500.
* Disallow non-zero memidx when bulk memory disabled (#1546)Paweł Bylica2020-09-172-0/+20
| | | | If bulk memory extension is disabled, do not allow memory index in the data segment other than zero.
* Fix integer overflow in objdump name tracking (#1524)Sam Clegg2020-08-191-0/+11
| | | | Fixes: #1520
* Added initial "memory64" proposal support (#1500)Wouter van Oortmerssen2020-08-072-6/+6
|
* Fix linking section symbol name bugs (#1508)Ben Smith2020-07-314-0/+112
| | | Found by oss-fuzz.
* Detect malformed memory/table limits flag (#1505)Paweł Bylica2020-07-314-0/+45
| | | | | | | | | | | | | | * Read memory/table limits flags as uint8_t In the wasm spec the limits flag is a single byte, not a LEB128 encoded value. * Detect malformed memory/table limits flag * Disallow shared memory when threads are disabled This adds additional check to disallow "is_shared" (0x2) flag for memory limits when threads extensions is not enabled. Previously this flag was unconditionally accepted.
* Fix reading of section code (#1501)Paweł Bylica2020-07-311-0/+10
| | | | The section code is just a single byte, not a LEB128-encoded value. With this fix the section code is now read correctly with ReadU8().
* Detect malformed import kind in binary reader (#1504)Paweł Bylica2020-07-301-0/+8
|
* Fix assert when function has struct type (#1498)Ben Smith2020-07-251-0/+12
| | | | | | | Function types and struct types share an index space, but a function can only be defined using a function type. Since `Module::GetFuncType` already returns `nullptr` for an OOB index, it makes sense to return `nullptr` for an invalid type too.
* Check for malformed alignment (#1454)Ben Smith2020-06-091-0/+18
| | | Fixes issue #1453.