Repository navigation
Compute container sizes in size_t - #12
Merged
Merged
Conversation
Products such as N_*N_*N_ were evaluated in int before widening, which overflows at about 1,300 molecules for trimer_.reserve. Resolves CodeQL cpp/integer-multiplication-cast-to-long alerts. Co-authored-by: Copilot <[email protected]> Copilot-Session: 3eaf20ea-3ac0-4701-958f-28527bf641fc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves the 5 open CodeQL
cpp/integer-multiplication-cast-to-longalerts.reserve/resizesizes were multiplied inintbefore being widened tosize_t:pbam/src/PhysCalcAM.cpp:dimer_.reserve(N_*N_)andtrimer_.reserve(N_*N_*N_).The trimer size overflows
intat about 1,300 molecules, soreservethrowsstd::length_errorinstead of succeeding.pbsam/src/TMatrix.cpp:T_.reserve(total_spheres*total_spheres).pb_shared/src/readutil.h:p*p*p*pandp*p(multipole order; included for consistency).Each product is now computed in
size_t. No behavior change for inputs that did not overflow.Validation
macOS (Apple BLAS, PBAM + PBSAM, testing on,
-DCMAKE_POLICY_VERSION_MINIMUM=3.5per #11): builds cleanly;pbamtest160 passed,pbsamtest102 passed.