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

Fix several issues found by fuzzing #1931

Merged
merged 8 commits into from
Sep 17, 2022
Merged

Fix several issues found by fuzzing #1931

merged 8 commits into from
Sep 17, 2022

Conversation

Mem2019
Copy link
Contributor

@Mem2019 Mem2019 commented Jun 1, 2022

Fixes #1922
Fixes #1924
Fixes #1929

Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Could you update the title so be a little more specific. Perhaps "Fix several issues found by fuzzing", and the you can do "Fixes #xxx, #yyy" in the description so have github automatically close those issue.

src/decompiler-ast.h Outdated Show resolved Hide resolved
@Mem2019 Mem2019 changed the title Fix issue 1922, 1924 and 1929 Fix several issues found by fuzzing Jun 1, 2022
@keithw
Copy link
Member

keithw commented Aug 15, 2022

@Mem2019 Thank you for fixing these! Do you have cycles to make the changes requested in the review and get this merged? Would be great to have this in...

@keithw keithw self-requested a review September 17, 2022 06:20
Copy link
Member

@keithw keithw left a comment

Choose a reason for hiding this comment

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

@sbc100 In an effort to get these issues closed, I made the requested changes and confirmed that the four regression tests fail before the patch is applied (and pass afterwards). Will plan to merge early next week unless you want to take another look.

@@ -1169,6 +1172,9 @@ Result BinaryReaderInterp::OnReturnCallExpr(Index func_index) {

Result BinaryReaderInterp::OnReturnCallIndirectExpr(Index sig_index,
Index table_index) {
if (sig_index >= module_.func_types.size()) {
return Result::Error;
}
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if these checks should be in the validator instead?

Copy link
Member

@sbc100 sbc100 Sep 17, 2022

Choose a reason for hiding this comment

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

Actually it looks like we already have this code above, can we call this instead?

CHECK_RESULT(
     validator_.OnCall(GetLocation(), Var(func_index, GetLocation())));		    

(edit: actually I guess not because that is validating func_index and not sig_index)

Copy link
Member

Choose a reason for hiding this comment

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

Ah, good point. I changed them to use validator_.OnReturnCall and validator_.OnReturnCallIndirect which looks like what it should have been doing all along.

Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

I wonder if that fact that we were missing those validation checks means there are some tests that are missing from the spec tests? i.e. why didn't the spec tests find these? I'm they are missing from the spec tests we should followup by filing bugs upstream and eventually remove these downstream tests.

@keithw
Copy link
Member

keithw commented Sep 17, 2022

I wonder if that fact that we were missing those validation checks means there are some tests that are missing from the spec tests? i.e. why didn't the spec tests find these?

I looked into this. In this case, the tail-call proposal tests would have caught these binary-reader-interp bugs (causing a segfault or asan failure). But we're not running the tail-call proposal tests because (I guess?) the interpreter doesn't support tail calls yet. :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants