-
Notifications
You must be signed in to change notification settings - Fork 756
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
[GC] Fix trapping on array.new_data of dropped segments of offset > 0 #7124
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there are no tests for dropped segments in combination with array.new_data or array.new_elem upstream. I'll make a PR adding some.
src/wasm-interpreter.h
Outdated
@@ -4023,7 +4023,7 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> { | |||
const auto& seg = *wasm.getDataSegment(curr->segment); | |||
auto elemBytes = element.getByteSize(); | |||
auto end = offset + size * elemBytes; | |||
if ((size != 0ull && droppedDataSegments.count(curr->segment)) || | |||
if ((offset + size > 0 && droppedDataSegments.count(curr->segment)) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we should check for overflow as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Co-authored-by: Thomas Lively <[email protected]>
Even if the size is 0, if the offset is > 0 then we should trap.
@tlively Is it expected there are no spec tests for this combination of GC+bulk memory?