mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
C++: Range analysis: support casts from/to typedef
This commit is contained in:
@@ -270,7 +270,7 @@ typedef unsigned char u8;
|
||||
|
||||
int widening_cast1(u8 c) {
|
||||
if (c == 0) {
|
||||
if ((int)c > 0) { // BAD [NOT DETECTED]
|
||||
if ((int)c > 0) { // BAD
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,7 @@ int widening_cast1(u8 c) {
|
||||
int widening_cast2(u8 c) {
|
||||
if (c <= 10)
|
||||
return -1;
|
||||
else if ((c >= 11) /* BAD [NOT DETECTED] */ && (c <= 47))
|
||||
else if ((c >= 11) /* BAD */ && (c <= 47))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
||||
@@ -33,5 +33,7 @@
|
||||
| PointlessComparison.c:197:7:197:11 | ... < ... | Comparison is always false because x >= 0. |
|
||||
| PointlessComparison.c:210:6:210:10 | ... < ... | Comparison is always false because e >= 0. |
|
||||
| PointlessComparison.c:264:12:264:22 | ... >= ... | Comparison is always true because dbl >= 0 and -0 >= - .... |
|
||||
| PointlessComparison.c:273:9:273:18 | ... > ... | Comparison is always false because c <= 0. |
|
||||
| PointlessComparison.c:283:13:283:19 | ... >= ... | Comparison is always true because c >= 11. |
|
||||
| RegressionTests.cpp:57:7:57:22 | ... <= ... | Comparison is always true because * ... <= 4294967295. |
|
||||
| Templates.cpp:9:10:9:24 | ... <= ... | Comparison is always true because local <= 32767. |
|
||||
|
||||
Reference in New Issue
Block a user