Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for alignment overflow #1751

Merged
merged 1 commit into from
May 8, 2024
Merged

Conversation

SoniEx2
Copy link
Contributor

@SoniEx2 SoniEx2 commented May 8, 2024

let's see what CI says about these...

closes #1749

@SoniEx2
Copy link
Contributor Author

SoniEx2 commented May 8, 2024

heh. looks like the test is working as intended. ^^

but also. uh, how do you fix that one?

../test/core/_output/align.wast.bin.wast.wast:1269.47-1269.54: syntax error: alignment must be a power of two
(assert_invalid
  (module
    (type $0 (func))
    (memory $0 1)
    (func $0 (type 0) (i32.const 0) (i32.load align=0) (drop))
  )
  "alignment must not be larger than natural"
)

@rossberg
Copy link
Member

rossberg commented May 8, 2024

To assert malformed text format, you'll need to use module quote, which defers parsing.

@SoniEx2
Copy link
Contributor Author

SoniEx2 commented May 8, 2024

take a look at the filename again, it's a roundtrip(?) one. we found a bug in the roundtrip(?) function.

@rossberg
Copy link
Member

rossberg commented May 8, 2024

Ah, actually, the bug is in the decoder not considering 2^32 malformed (which then overflows into 0 when converting to text).

Can you try changing the le_u in interpreter/binary/decode.ml:223 to lt_u?

Copy link
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

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

Thanks. (But please never force-push to a branch under review, that breaks GH PR mechanics.)

@rossberg rossberg merged commit 2285497 into WebAssembly:main May 8, 2024
1 check passed
@SoniEx2
Copy link
Contributor Author

SoniEx2 commented May 8, 2024

oh, really? sorry, we're so used to force-pushing for other projects we contribute to, but we'll keep it in mind.

@SoniEx2 SoniEx2 deleted the patch-2 branch May 8, 2024 20:23
@rossberg
Copy link
Member

rossberg commented May 8, 2024

Well, it's a common mistake, but you shouldn't do that for any GH project. As just one example of what breaks, here is what happens to commit links; reviewers lose relative diffs and diff links, comments get orphaned or vanish, etc.

@SoniEx2
Copy link
Contributor Author

SoniEx2 commented May 8, 2024

ah, we see...

interestingly(? or frustratingly, as it may be) github also provides a "compare" link on the web interface that does work: https://github.com/WebAssembly/spec/compare/b2e95b5d1231ad49d0b381a1af39483e5697c79c..9a09f09f6c6191706ae4a39b6c0aee905f3029ae

but yeah, we see what you mean.

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.

Test extreme alignments
2 participants