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(compiler): Read custom sections in full #1243

Merged
merged 1 commit into from
May 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions compiler/src/utils/wasm_utils.re
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,8 @@ module BinarySection =
/* Now we're at the start of the section. Time to read */
let realsize = size - (pos_in(inchan) - offset);
let bytes = Bytes.create(realsize);
if (input(inchan, bytes, 0, realsize) == realsize) {
Some(Spec.deserialize(bytes));
} else {
process(tl);
};
really_input(inchan, bytes, 0, realsize);
Copy link
Member

Choose a reason for hiding this comment

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

Is it okay that this will raise if we can't read it all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed! If all the bytes aren't there (when the module reported that they were) means the module is corrupted.

Some(Spec.deserialize(bytes));
| _ => process(tl)
};
};
Expand Down