-
Notifications
You must be signed in to change notification settings - Fork 916
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 potential int overflow in merge chunks #7603
Fix potential int overflow in merge chunks #7603
Conversation
When merging chunks, a relation size calculation could potentially overflow an 32-bit integer value. Use a 64-bit integer for the result to prevent overflow.
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.
LGTM
if (forkNumber == MAIN_FORKNUM) | ||
return merge_rel_nblocks * BLCKSZ; | ||
return nblocks * BLCKSZ; |
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.
An option is to just add a cast.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7603 +/- ##
==========================================
+ Coverage 80.06% 82.29% +2.23%
==========================================
Files 190 238 +48
Lines 37181 44140 +6959
Branches 9450 11101 +1651
==========================================
+ Hits 29770 36327 +6557
- Misses 2997 3430 +433
+ Partials 4414 4383 -31 ☔ View full report in Codecov by Sentry. |
@mkindahl, @antekresic: please review this pull request.
|
Pushed this to Coverity and the report looks clean. |
When merging chunks, a relation size calculation could potentially overflow an 32-bit integer value. Use a 64-bit integer for the result to prevent overflow.
Disable-check: force-changelog-file
Disable-check: approval-count