From: Alan Modra Date: Thu, 2 Sep 2021 23:04:05 +0000 (+0930) Subject: ubsan: libctf: applying zero offset to null pointer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=174fe10cb6809390b38e9a3bc2bf88e3eddfe5ee;p=binutils-gdb.git ubsan: libctf: applying zero offset to null pointer * ctf-open.c (init_symtab): Avoid ubsan error. --- diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index 1c69dc83102..9e2c57051af 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -238,7 +238,7 @@ init_symtab (ctf_dict_t *fp, const ctf_header_t *hp, const ctf_sect_t *sp) int skip_func_info = 0; int i; uint32_t *xp = fp->ctf_sxlate; - uint32_t *xend = xp + fp->ctf_nsyms; + uint32_t *xend = PTR_ADD (xp, fp->ctf_nsyms); uint32_t objtoff = hp->cth_objtoff; uint32_t funcoff = hp->cth_funcoff;