mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
[CPP-434] Drop the requirement that RHS not be cast to unsigned, since overflow occurs on LHS. Adjust test case.
This commit is contained in:
@@ -25,6 +25,5 @@ where
|
||||
add.getAnOperand() = va1 and
|
||||
ro.getAnOperand() = va2 and
|
||||
globalValueNumber(va1) = globalValueNumber(va2) and
|
||||
isSignedWithoutUnsignedCast(add) and
|
||||
isSignedWithoutUnsignedCast(va2)
|
||||
isSignedWithoutUnsignedCast(add)
|
||||
select ro, "Testing for signed overflow may produce undefined results."
|
||||
|
||||
@@ -94,11 +94,7 @@ int checkOverflow4(unsigned int ioff, C c) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define AV_INPUT_BUFFER_PADDING_SIZE 64
|
||||
|
||||
int overflow12(int codecdata_length) {
|
||||
if(codecdata_length + AV_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length) { // GOOD
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
int overflow12(int n) {
|
||||
// not deleted by gcc or clang
|
||||
return (n + 32 <= (unsigned)n? -1: 1); // BAD
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
| SignedOverflowCheck.cpp:8:12:8:22 | ... < ... | Testing for signed overflow may produce undefined results. |
|
||||
| SignedOverflowCheck.cpp:18:12:18:26 | ... < ... | Testing for signed overflow may produce undefined results. |
|
||||
| SignedOverflowCheck.cpp:35:9:35:23 | ... < ... | Testing for signed overflow may produce undefined results. |
|
||||
| SignedOverflowCheck.cpp:99:10:99:30 | ... <= ... | Testing for signed overflow may produce undefined results. |
|
||||
|
||||
Reference in New Issue
Block a user