Fix the one "value" complaint from CodeQL and suppress all useless queries.

This commit is contained in:
Michael R Sweet 2022-12-09 11:22:10 -05:00
parent c7101ae9dd
commit 948ee16b06
No known key found for this signature in database
GPG Key ID: 999559A027815955
3 changed files with 20 additions and 7 deletions

19
.github/codeql.yml vendored
View File

@ -1,7 +1,22 @@
paths-ignore: paths-ignore:
- 'test*.c' - 'test**.c'
query-filters: query-filters:
- exclude: - exclude:
id: cpp/commented-out-code id: cpp/commented-out-code
- exclude:
id: cpp/toctou-race-condition
- exclude:
id: cpp/weak-cryptographic-algorithm
- exclude:
id: cpp/world-writable-file-creation
- exclude:
id: cpp/uncontrolled-allocation-size
- exclude:
id: cpp/path-injection
- exclude:
id: cpp/stack-address-escape
- exclude:
id: cpp/loop-variable-changed
- exclude:
id: cpp/long-switch

View File

@ -1,2 +0,0 @@
queries:
- exclude: cpp/toctou-race-condition

6
ttf.c
View File

@ -420,7 +420,7 @@ ttfCreate(const char *filename, // I - Filename
if (read_os_2(font, &os_2)) if (read_os_2(font, &os_2))
{ {
// Copy key values from OS/2 table... // Copy key values from OS/2 table...
static const ttf_stretch_t widths[] = static const ttf_stretch_t stretches[] =
{ {
TTF_STRETCH_ULTRA_CONDENSED, // ultra-condensed TTF_STRETCH_ULTRA_CONDENSED, // ultra-condensed
TTF_STRETCH_EXTRA_CONDENSED, // extra-condensed TTF_STRETCH_EXTRA_CONDENSED, // extra-condensed
@ -433,8 +433,8 @@ ttfCreate(const char *filename, // I - Filename
TTF_STRETCH_ULTRA_EXPANDED // ultra-expanded TTF_STRETCH_ULTRA_EXPANDED // ultra-expanded
}; };
if (os_2.usWidthClass >= 1 && os_2.usWidthClass <= (int)(sizeof(widths) / sizeof(widths[0]))) if (os_2.usWidthClass >= 1 && os_2.usWidthClass <= (int)(sizeof(stretches) / sizeof(stretches[0])))
font->stretch = widths[os_2.usWidthClass - 1]; font->stretch = stretches[os_2.usWidthClass - 1];
font->weight = (short)os_2.usWeightClass; font->weight = (short)os_2.usWeightClass;
font->cap_height = os_2.sCapHeight; font->cap_height = os_2.sCapHeight;