mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
C++: Add test case exposing problem with overflows for upperBound predicate
This commit is contained in:
@@ -599,6 +599,10 @@
|
||||
| test.c:675:7:675:7 | y | -2147483648 |
|
||||
| test.c:684:7:684:7 | x | -2147483648 |
|
||||
| test.c:689:7:689:7 | x | -2147483648 |
|
||||
| test.c:696:8:696:8 | x | 2147483647 |
|
||||
| test.c:696:12:696:12 | y | 256 |
|
||||
| test.c:697:9:697:9 | x | 2147483647 |
|
||||
| test.c:698:9:698:9 | y | 256 |
|
||||
| test.cpp:10:7:10:7 | b | -2147483648 |
|
||||
| test.cpp:11:5:11:5 | x | -2147483648 |
|
||||
| test.cpp:13:10:13:10 | x | -2147483648 |
|
||||
|
||||
@@ -689,3 +689,12 @@ label:
|
||||
out(x);
|
||||
goto label;
|
||||
}
|
||||
|
||||
void test_overflow() {
|
||||
const int x = 2147483647; // 2^31-1
|
||||
const int y = 256;
|
||||
if ((x + y) <= 512) {
|
||||
out(x);
|
||||
out(y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,6 +599,10 @@
|
||||
| test.c:675:7:675:7 | y | 2147483647 |
|
||||
| test.c:684:7:684:7 | x | 2147483647 |
|
||||
| test.c:689:7:689:7 | x | 15 |
|
||||
| test.c:696:8:696:8 | x | 2147483647 |
|
||||
| test.c:696:12:696:12 | y | 256 |
|
||||
| test.c:697:9:697:9 | x | 256 |
|
||||
| test.c:698:9:698:9 | y | -2147483135 |
|
||||
| test.cpp:10:7:10:7 | b | 2147483647 |
|
||||
| test.cpp:11:5:11:5 | x | 2147483647 |
|
||||
| test.cpp:13:10:13:10 | x | 2147483647 |
|
||||
|
||||
Reference in New Issue
Block a user