From 63ad6c1d03ea727657ffdcf43def85381d277579 Mon Sep 17 00:00:00 2001 From: James Bonfield Date: Thu, 18 Jul 2024 12:28:40 +0100 Subject: [PATCH] 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. --- vcf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vcf.c b/vcf.c index 53f2b7a92..daedad34d 100644 --- a/vcf.c +++ b/vcf.c @@ -4020,7 +4020,10 @@ int vcf_format(const bcf_hdr_t *h, const bcf1_t *v, kstring_t *s) kputc_('\t', s); // INFO if (v->n_info) { - uint8_t *ptr = (uint8_t *)v->shared.s + v->unpack_size[0] + v->unpack_size[1] + v->unpack_size[2]; + uint8_t *ptr = v->shared.s + ? (uint8_t *)v->shared.s + v->unpack_size[0] + + v->unpack_size[1] + v->unpack_size[2] + : NULL; int first = 1; bcf_info_t *info = v->d.info;