Skip to content

Minor one-line rewrite to avoid undefined behaviour#1962

Merged
vasudeva8 merged 1 commit intosamtools:developfrom
jmarshall:fix-null-ptr-arith
Oct 10, 2025
Merged

Minor one-line rewrite to avoid undefined behaviour#1962
vasudeva8 merged 1 commit intosamtools:developfrom
jmarshall:fix-null-ptr-arith

Conversation

@jmarshall
Copy link
Member

Even adding zero to a null pointer is not kosher, and produces diagnostics at runtime with ‑fsanitize=undefined:

synced_bcf_reader.c:267:13: runtime error: applying zero offset to null pointer

Also use strlen(HTS_IDX_DELIM) for clarity — it will be optimised to the same constant as the sizeof version anyway, and is already used elsewhere.

Also use `strlen(HTS_IDX_DELIM)` for clarity -- it will be optimised
to the same constant anyway.
@vasudeva8 vasudeva8 merged commit aaa4784 into samtools:develop Oct 10, 2025
9 checks passed
@vasudeva8
Copy link
Contributor

Thank you John, it is merged.

@jmarshall jmarshall deleted the fix-null-ptr-arith branch October 10, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants