PR26431 UBSAN: pe-dll.c:568 null pointer bsearch

PR 26431
	* pe-dll.c (auto_export): Don't call bsearch with zero count.
This commit is contained in:
Alan Modra
2020-08-26 14:23:42 +09:30
parent 9863cbb7bd
commit aaf9875ef9
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2020-08-26 Alan Modra <amodra@gmail.com>
PR 26431
* pe-dll.c (auto_export): Don't call bsearch with zero count.
2020-08-25 Alan Modra <amodra@gmail.com> 2020-08-25 Alan Modra <amodra@gmail.com>
* testsuite/ld-libs/libs.exp: Don't run on sh-pe, tic30 or tic54x. * testsuite/ld-libs/libs.exp: Don't run on sh-pe, tic30 or tic54x.

View File

@ -565,8 +565,9 @@ auto_export (bfd *abfd, def_file *d, const char *n)
key.name = key.its_name = (char *) n; key.name = key.its_name = (char *) n;
/* Return false if n is in the d->exports table. */ /* Return false if n is in the d->exports table. */
if (bsearch (&key, d->exports, d->num_exports, if (d->num_exports != 0
sizeof (pe_def_file->exports[0]), pe_export_sort)) && bsearch (&key, d->exports, d->num_exports,
sizeof (pe_def_file->exports[0]), pe_export_sort))
return 0; return 0;
if (pe_dll_do_default_excludes) if (pe_dll_do_default_excludes)