Skip to content

Commit

Permalink
Fix truncated comparison of format for "fastq.gz".
Browse files Browse the repository at this point in the history
The buffer size is 8, but it includes \0 so the string would have been
truncated, causing the strcmp to fail.

Curiously gcc 10 and 11 spot this, but not gcc 12 or 13, nor clang.
  • Loading branch information
jkbonfield committed Aug 22, 2024
1 parent a0b381d commit 047bbee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ rocky_task:
LC_ALL: C
CIRRUS_CLONE_DEPTH: 1
USE_CONFIG: yes
CFLAGS: -std=gnu90 -Wformat -Wformat=2 -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-empty-body
CFLAGS: -g -O3 -std=gnu90 -Wformat -Wformat=2 -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-empty-body

# NB: we could consider building a docker image with these
# preinstalled and specifying that instead, to speed up testing.
Expand Down
2 changes: 1 addition & 1 deletion hts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ int hts_parse_opt_list(htsFormat *fmt, const char *str) {
* -1 on failure.
*/
int hts_parse_format(htsFormat *format, const char *str) {
char fmt[8];
char fmt[9];
const char *cp = scan_keyword(str, ',', fmt, sizeof fmt);

format->version.minor = 0; // unknown
Expand Down

0 comments on commit 047bbee

Please sign in to comment.