From: Tristan Gingold Date: Tue, 1 Apr 2014 12:34:04 +0000 (+0200) Subject: bfd/mach-o: avoid a crash when num == 0 in reloc. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=23d72939765598839d20dfb70c986206bf7751ca;p=binutils-gdb.git bfd/mach-o: avoid a crash when num == 0 in reloc. bfd/ * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Avoid to crash when num == 0. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index badd4c925e9..442f8ada480 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2014-04-01 Tristan Gingold + + * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Avoid to crash + when num == 0. + 2014-03-27 Yury Gribov Pavel Fedin diff --git a/bfd/mach-o.c b/bfd/mach-o.c index ebaa6c7852a..e33c01f1e4a 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -1075,7 +1075,7 @@ bfd_mach_o_canonicalize_one_reloc (bfd *abfd, /* An external symbol number. */ sym = syms + num; } - else if (num == 0x00ffffff) + else if (num == 0x00ffffff || num == 0) { /* The 'symnum' in a non-scattered PAIR is 0x00ffffff. But as this is generic code, we don't know wether this is really a PAIR. @@ -1087,7 +1087,6 @@ bfd_mach_o_canonicalize_one_reloc (bfd *abfd, else { /* A section number. */ - BFD_ASSERT (num != 0); BFD_ASSERT (num <= mdata->nsects); sym = mdata->sections[num - 1]->bfdsection->symbol_ptr_ptr;