File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed
cpp/ql/test/query-tests/jsf/4.21 Operators/AV Rule 164 Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ | test.c:3:2:3:9 | ... >> ... | AV Rule 164: The right-hand operand (here a value is -1) of this shift shall lie between 0 and 7. |
2+ | test.c:6:2:6:8 | ... >> ... | AV Rule 164: The right-hand operand (here a value is 8) of this shift shall lie between 0 and 7. |
3+ | test.c:8:2:8:9 | ... << ... | AV Rule 164: The right-hand operand (here a value is -1) of this shift shall lie between 0 and 7. |
4+ | test.c:11:2:11:8 | ... << ... | AV Rule 164: The right-hand operand (here a value is 8) of this shift shall lie between 0 and 7. |
5+ | test.c:18:2:18:9 | ... >> ... | AV Rule 164: The right-hand operand (here a value is -1) of this shift shall lie between 0 and 7. |
6+ | test.c:21:2:21:8 | ... >> ... | AV Rule 164: The right-hand operand (here a value is 8) of this shift shall lie between 0 and 7. |
7+ | test.c:23:2:23:25 | ... >> ... | AV Rule 164: The right-hand operand (here a value is -1) of this shift shall lie between 0 and 31. |
Original file line number Diff line number Diff line change 1+ jsf/4.21 Operators/AV Rule 164.ql
Original file line number Diff line number Diff line change 1+
2+ void f (unsigned char uc , signed char sc , int i ) {
3+ uc >> -1 ; // BAD
4+ uc >> 0 ;
5+ uc >> 7 ;
6+ uc >> 8 ; // BAD
7+
8+ uc << -1 ; // BAD
9+ uc << 0 ;
10+ uc << 7 ;
11+ uc << 8 ; // BAD
12+
13+ uc >>= -1 ; // BAD [NOT DETECTED]
14+ uc >>= 0 ; // BAD [NOT DETECTED]
15+ uc >>= 7 ;
16+ uc >>= 8 ; // BAD [NOT DETECTED]
17+
18+ sc >> -1 ; // BAD
19+ sc >> 0 ;
20+ sc >> 7 ;
21+ sc >> 8 ; // BAD
22+
23+ ((unsigned char )i ) >> -1 ; // BAD
24+ ((unsigned char )i ) >> 0 ;
25+ ((unsigned char )i ) >> 7 ;
26+ ((unsigned char )i ) >> 8 ; // BAD [NOT DETECTED]
27+ }
28+
You can’t perform that action at this time.
0 commit comments