aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-26 20:28:40 +0930
committerAlan Modra <amodra@gmail.com>2020-08-26 23:23:45 +0930
commite637b7ba2f8399ba94721be3f1765b471b6a67c2 (patch)
treecb1700224c36381624e8f6051dd1680f67cf343d /gas/config
parent4d43072582c3ccbb86485d79107a9d3550a1557a (diff)
downloadgdb-e637b7ba2f8399ba94721be3f1765b471b6a67c2.zip
gdb-e637b7ba2f8399ba94721be3f1765b471b6a67c2.tar.gz
gdb-e637b7ba2f8399ba94721be3f1765b471b6a67c2.tar.bz2
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.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-xtensa.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 82ec439..af4c667 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),