Skip to content

Commit be75e7f

Browse files
committed
ctype: help CodeQL understand that sane_istest() does not access array past end
Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 353f699 commit be75e7f

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

t/unit-tests/u-ctype.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,70 +33,70 @@
3333

3434
void test_ctype__isspace(void)
3535
{
36-
TEST_CHAR_CLASS(isspace, " \n\r\t");
36+
TEST_CHAR_CLASS(isspace, " \n\r\t"); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
3737
}
3838

3939
void test_ctype__isdigit(void)
4040
{
41-
TEST_CHAR_CLASS(isdigit, DIGIT);
41+
TEST_CHAR_CLASS(isdigit, DIGIT); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
4242
}
4343

4444
void test_ctype__isalpha(void)
4545
{
46-
TEST_CHAR_CLASS(isalpha, LOWER UPPER);
46+
TEST_CHAR_CLASS(isalpha, LOWER UPPER); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
4747
}
4848

4949
void test_ctype__isalnum(void)
5050
{
51-
TEST_CHAR_CLASS(isalnum, LOWER UPPER DIGIT);
51+
TEST_CHAR_CLASS(isalnum, LOWER UPPER DIGIT); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
5252
}
5353

5454
void test_ctype__is_glob_special(void)
5555
{
56-
TEST_CHAR_CLASS(is_glob_special, "*?[\\");
56+
TEST_CHAR_CLASS(is_glob_special, "*?[\\"); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
5757
}
5858

5959
void test_ctype__is_regex_special(void)
6060
{
61-
TEST_CHAR_CLASS(is_regex_special, "$()*+.?[\\^{|");
61+
TEST_CHAR_CLASS(is_regex_special, "$()*+.?[\\^{|"); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
6262
}
6363

6464
void test_ctype__is_pathspec_magic(void)
6565
{
66-
TEST_CHAR_CLASS(is_pathspec_magic, "!\"#%&',-/:;<=>@_`~");
66+
TEST_CHAR_CLASS(is_pathspec_magic, "!\"#%&',-/:;<=>@_`~"); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
6767
}
6868

6969
void test_ctype__isascii(void)
7070
{
71-
TEST_CHAR_CLASS(isascii, ASCII);
71+
TEST_CHAR_CLASS(isascii, ASCII); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
7272
}
7373

7474
void test_ctype__islower(void)
7575
{
76-
TEST_CHAR_CLASS(islower, LOWER);
76+
TEST_CHAR_CLASS(islower, LOWER); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
7777
}
7878

7979
void test_ctype__isupper(void)
8080
{
81-
TEST_CHAR_CLASS(isupper, UPPER);
81+
TEST_CHAR_CLASS(isupper, UPPER); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
8282
}
8383

8484
void test_ctype__iscntrl(void)
8585
{
86-
TEST_CHAR_CLASS(iscntrl, CNTRL);
86+
TEST_CHAR_CLASS(iscntrl, CNTRL); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
8787
}
8888

8989
void test_ctype__ispunct(void)
9090
{
91-
TEST_CHAR_CLASS(ispunct, PUNCT);
91+
TEST_CHAR_CLASS(ispunct, PUNCT); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
9292
}
9393

9494
void test_ctype__isxdigit(void)
9595
{
96-
TEST_CHAR_CLASS(isxdigit, DIGIT "abcdefABCDEF");
96+
TEST_CHAR_CLASS(isxdigit, DIGIT "abcdefABCDEF"); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
9797
}
9898

9999
void test_ctype__isprint(void)
100100
{
101-
TEST_CHAR_CLASS(isprint, LOWER UPPER DIGIT PUNCT " ");
101+
TEST_CHAR_CLASS(isprint, LOWER UPPER DIGIT PUNCT " "); // CodeQL [SM01947] justification: Code implicitly exercises sane_istest() macro extensively; CodeQL misses the (unsigned char) cast, mistaking accesses for being past array end
102102
}

0 commit comments

Comments
 (0)