-
Notifications
You must be signed in to change notification settings - Fork 87
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 a bug in CCP instruction #753
Conversation
fuel-vm/src/tests/blockchain.rs
Outdated
/// TODO: remove this test after review, the one above covers it better | ||
#[test] | ||
fn code_copy_ownership_overflow_poc() { |
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 reproction test case is from the audit report, and kept here for the review. It should be removed before merging.
|
||
let src_end = src_offset.saturating_add(range.len()).min(src.len()); | ||
let data = src.get(src_offset..src_end).unwrap_or_default(); | ||
let (r_data, r_zero) = range.split_at_offset(data.len()); | ||
|
||
memory |
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.
Hmm, maybe we need to revisit all places where we use write_noownerchecks
, maybe we don't need it anymore and we can just pass OwnershipRegisters
CCP instruction was not checking for ownership properly. This PR fixes the bug, and refactors the code a bit so that similar issues cannot occur again as easily.
Checklist
Before requesting review