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.
This commit is contained in:
Alan Modra 2020-08-26 20:28:40 +09:30
parent 4d43072582
commit e637b7ba2f
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2020-08-26 Alan Modra <amodra@gmail.com>
PR 26508
* config/tc-xtensa.c (xg_get_trampoline_chain): Return early
when n_entries is zero.
2020-08-26 Alan Modra <amodra@gmail.com>
PR 26448

View File

@ -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),