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
Change iovec len from usize to u32 #4380
base: main
Are you sure you want to change the base?
Conversation
@@ -68,7 +68,7 @@ impl IoVecBuffer { | |||
iov_base, | |||
iov_len: desc.len as size_t, | |||
}); | |||
len += desc.len as usize; | |||
len += desc.len; |
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.
We can add a check for overflow here.
@@ -217,14 +217,14 @@ impl IoVecBufferMut { | |||
iov_base, | |||
iov_len: desc.len as size_t, | |||
}); | |||
len += desc.len as usize; | |||
len += desc.len; |
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.
Same as above
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4380 +/- ##
==========================================
- Coverage 81.52% 81.51% -0.01%
==========================================
Files 241 241
Lines 29249 29247 -2
==========================================
- Hits 23844 23842 -2
Misses 5405 5405
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
86c62f4
to
ed6b636
Compare
Changing the type of IoVecBuffer's and IoVecBufferMut's len from usize to u32 as the buffer size can only be up to 2^32 -1 bytes. Signed-off-by: Marco Bellan <marcobll@amazon.com>
Resolves #4548 |
Changes
Changing the type of
iovec len
fromusize
tou32
Resolves #4548
Reason
This is to better reflect the buffer size and prevent buffer overflows.
...
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following
Developer Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md
.PR Checklist
CHANGELOG.md
.TODO
s link to an issue.rust-vmm
.