Repository navigation
Conversation
Contributor
|
There should probably be a trac ticket for this PR. Please create it, or ask us to create it. Then the PR title should be updated. |
Contributor
Author
|
hey can anyone create trac ticket for this pr, thanks. |
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.
CheckBufferOverrunImpl::getBufferSize, accumulateStructMembers (used by ValueType::getSizeOf) and setValues in clangimport multiply the array dimensions of a variable in MathLib::bigint without an overflow check, so a declaration like
char a[0x100000000][0x100000000];in the checked code makes cppcheck run into signed integer overflow (UBSan at checkbufferoverrun.cpp:635 and symboldatabase.cpp:8702). When the product wraps to a small value the results are wrong as well: forchar a[0x4000000000000001][4]; memset(a, 0, 10);cppcheck reports bufferAccessOutOfBounds, andsizeofof a struct holding that array is folded to 4. Added Variable::dimensionsProduct, which reports the overflow, and all three sites now treat an overflowing product as an unknown size; sizes that fit are unchanged. TestBufferOverrun::arraysize_overflow and a new case in TestValueFlow::valueFlowSizeof fail without the change, the full testrunner passes, and TestBufferOverrun, TestValueFlow and TestClangImport also pass in a build with -fsanitize=signed-integer-overflow. I don't have Trac access, could one of you create a ticket for this so I can reference it in the title?