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

debug: Avoid underflow when scanning for landing pad bytes #2866

Merged
merged 1 commit into from
May 3, 2021

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Apr 30, 2021

I don't really know what I'm doing here, but bear with me... This landing pad bytes scanning assumes at least 2 bytes in the given buffer, but in a local test case I was trying against, the buffer was empty, so 0 bytes, so the subtract would underflow. Just adding this guard seems to make it work-ish -- I don't get full variable inspection power, but I expect that this is unrelated to my change.

@alexcrichton
Copy link
Member

Do you know if it would be possible to add a test for this?

@bnjbvr
Copy link
Member Author

bnjbvr commented May 3, 2021

Unfortunately, it's a very very large module, hard to break up. If you've got a tool or a magic command line that can take the wat and automatically reduce it, I'm willing to try it. Unfortunately I don't know enough about this code so as to be able to craft a test case from scratch.

@alexcrichton
Copy link
Member

Ah ok, seems fine then!

@alexcrichton alexcrichton merged commit 8811246 into bytecodealliance:main May 3, 2021
@bjorn3
Copy link
Contributor

bjorn3 commented May 3, 2021

You could try creduce on the .wat file. Creduce works relatively well on anything that even remotely looks like C. Wat having paired parens should be C like enough for it to work.

@bnjbvr bnjbvr deleted the debug-overflow branch May 3, 2021 17:18
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