File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
cpp/ql/test/query-tests/Likely Bugs/Arithmetic/BadAdditionOverflowCheck Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ | templates.cpp:20:5:20:25 | ... < ... | Self comparison. |
2+ | templates.cpp:21:5:21:25 | ... < ... | Self comparison. |
3+ | templates.cpp:21:5:21:25 | ... < ... | Self comparison. |
4+ | templates.cpp:22:5:22:25 | ... < ... | Self comparison. |
5+ | templates.cpp:22:5:22:25 | ... < ... | Self comparison. |
6+ | templates.cpp:22:5:22:25 | ... < ... | Self comparison. |
17| test.cpp:13:11:13:21 | ... == ... | Self comparison. |
28| test.cpp:79:11:79:32 | ... == ... | Self comparison. |
39| test.cpp:83:10:83:15 | ... == ... | Self comparison. |
Original file line number Diff line number Diff line change 1+ struct C1 {
2+ static const int value = 5 ;
3+ };
4+
5+ struct C2 {
6+ static const int value = 6 ;
7+ };
8+
9+ template <typename T1, typename T2>
10+ bool compareValues () {
11+ // Not all instantiations have T1 and T2 equal. Even if that's the case for
12+ // all instantiations in the program, there could still be more such
13+ // instantiations outside.
14+ return
15+ T1::value < T2::value || // GOOD [FALSE POSITIVE]
16+ T1::value < T1::value || // BAD
17+ C1::value < C1::value ; // BAD
18+ }
19+
20+ bool callCompareValues () {
21+ return compareValues<C1, C2> || compareValues<C1, C1>();
22+ }
You can’t perform that action at this time.
0 commit comments