-
Notifications
You must be signed in to change notification settings - Fork 293
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
advanced: Prevent invalid memory subscript index #339
Conversation
What version? Do you have CI log? |
Do you have a unit test for this? |
lib/evmone/execution.cpp
Outdated
return evmc::make_result( | ||
state.status, gas_left, &state.memory[state.output_offset], state.output_size); | ||
return evmc::make_result(state.status, gas_left, | ||
state.output_size != 0 ? &state.memory[state.output_offset] : nullptr, state.output_size); |
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.
This can be fixed with state.memory.data() + state.output_offset
because evmc::make_result()
will not use the pointer if output_size
is 0.
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.
Sure, done.
Codecov Report
@@ Coverage Diff @@
## master #339 +/- ##
=======================================
Coverage 99.78% 99.78%
=======================================
Files 29 29
Lines 4108 4108
=======================================
Hits 4099 4099
Misses 9 9
Flags with carried forward coverage won't be shown. Click here to find out more.
|
It was triggered by running Silkworm's core_test in Debug on Windows. Unfortunately, it didn't show in our Windows CI because it only has Release. |
ddbce46
to
8819740
Compare
I suppose something like |
* Update evmone to prevent out of range access * Switch back to upstream evm1 as ethereum/evmone/pull/339 is merged
triggered in MSVC debug build (Visual Studio 2019 version 16.10)