Skip to content

Conversation

@chfast
Copy link
Contributor

@chfast chfast commented Sep 17, 2020

Related to the bug in WABT: WebAssembly/wabt#1546,
found by Fizzy fuzzing.

"\01\00" ;; data segment 0 for memory 1 with malformed index expr
)
"unexpected end of section or function"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: newline missing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to replace this test with an "assert_invalid" one. It detect the same bug in WABT, but contains single error.

;; "constant expression required"
;; )

;; data segment with memory index 1 (only memory 0 available)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's ;; Data without memory section above, maybe better to move these over there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved.

;; "constant expression required"
;; )

;; data segment with memory index 1 (only memory 0 available)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness I would also add a test with imported memory defined, and data segment with memory index 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@chfast chfast force-pushed the invalid_data_segment_memidx branch from d1ee577 to f375d45 Compare September 23, 2020 19:49
@chfast
Copy link
Contributor Author

chfast commented Nov 10, 2020

As WABT is fixed already, can we merge this PR here too?

@rossberg rossberg merged commit 02a6f4f into WebAssembly:master Nov 10, 2020
@rossberg
Copy link
Member

Merged. Btw, please don't force-push to PR branches, because that breaks the review mechanics.

@chfast chfast deleted the invalid_data_segment_memidx branch November 10, 2020 16:44
chfast added a commit to wasmx/wasm-spec that referenced this pull request Nov 10, 2020
ngzhian added a commit to ngzhian/spec that referenced this pull request Nov 4, 2021
* [spec] automate instruction index rebuild (WebAssembly#1259)

* [test] Add test for malformed functype (WebAssembly#1254)

* [test] Correct tests for missing elements (WebAssembly#1251)

Remove the code section in tests for malformed element section.
Otherwise the code section id (0x0a) is taken as an element's table
index what is a validation error.

This is similar to the previously reported issue:
WebAssembly#1170.

* [test] Add tests for data segment with memidx 1 (WebAssembly#1249)

* [test] Correct i32.store alignment in a LEB128 test (WebAssembly#1261)

In the binary-leb128.wast, change the alignment of an i32.store
instruction from 3 (invalid) to 2 (the intention suggested by the
comment).

Co-authored-by: Andreas Rossberg <rossberg@dfinity.org>
Co-authored-by: Paweł Bylica <chfast@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants