Skip to content

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

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
bnjbvr:debug-overflow
May 3, 2021
Merged

debug: Avoid underflow when scanning for landing pad bytes#2866
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
bnjbvr:debug-overflow

Conversation

@bnjbvr
Copy link
Copy Markdown
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
Copy Markdown
Member

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

@bnjbvr
Copy link
Copy Markdown
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
Copy Markdown
Member

Ah ok, seems fine then!

@alexcrichton alexcrichton merged commit 8811246 into bytecodealliance:main May 3, 2021
@bjorn3
Copy link
Copy Markdown
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