From: Alan Modra Date: Wed, 26 Aug 2020 10:58:40 +0000 (+0930) Subject: PR26508 UBSAN: tc-xtensa.c:7764 null pointer bsearch X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e637b7ba2f8399ba94721be3f1765b471b6a67c2;p=binutils-gdb.git PR26508 UBSAN: tc-xtensa.c:7764 null pointer bsearch PR 26508 * config/tc-xtensa.c (xg_get_trampoline_chain): Return early when n_entries is zero. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index c56b992685c..c0d9b26a29c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2020-08-26 Alan Modra + + PR 26508 + * config/tc-xtensa.c (xg_get_trampoline_chain): Return early + when n_entries is zero. + 2020-08-26 Alan Modra PR 26448 diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 82ec4393322..af4c66721a6 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -7753,6 +7753,9 @@ xg_get_trampoline_chain (struct trampoline_seg *ts, struct trampoline_chain_index *idx = &ts->chain_index; struct trampoline_chain c; + if (idx->n_entries == 0) + return NULL; + if (idx->needs_sorting) { qsort (idx->entry, idx->n_entries, sizeof (*idx->entry),