Skip to content

Commit fbe5ff6

Browse files
jkbonfielddaviesrob
authored andcommitted
Fix an undefined addition to a NULL pointer in vcf_format.
The pointer was never used, but the NULL+0 still triggers clang's ubsan.
1 parent 25d03c6 commit fbe5ff6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vcf.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4020,7 +4020,10 @@ int vcf_format(const bcf_hdr_t *h, const bcf1_t *v, kstring_t *s)
40204020

40214021
kputc_('\t', s); // INFO
40224022
if (v->n_info) {
4023-
uint8_t *ptr = (uint8_t *)v->shared.s + v->unpack_size[0] + v->unpack_size[1] + v->unpack_size[2];
4023+
uint8_t *ptr = v->shared.s
4024+
? (uint8_t *)v->shared.s + v->unpack_size[0] +
4025+
v->unpack_size[1] + v->unpack_size[2]
4026+
: NULL;
40244027
int first = 1;
40254028
bcf_info_t *info = v->d.info;
40264029

0 commit comments

Comments
 (0)