[PATCH] D25016: [ELF] - Fixed assert fail when symbol table has invalid sh_info value.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 13:49:40 PDT 2016


I was reading in chronological order and was wondering why we started
hardening LLD for broken inputs at the moment, and finally reached
https://llvm.org/bugs/show_bug.cgi?id=30540. I agree that that's a good
thing to do.

On Wed, Sep 28, 2016 at 1:08 PM, Rafael Ávila de Espíndola <
rafael.espindola at gmail.com> wrote:

> rafael added inline comments.
>
> ================
> Comment at: ELF/InputFiles.cpp:84
> @@ -83,3 +83,3 @@
>    uint32_t FirstNonLocal = Symtab->sh_info;
> -  if (FirstNonLocal > NumSymbols)
> +  if (!FirstNonLocal || (FirstNonLocal > NumSymbols))
>      fatal(getFilename(this) + ": invalid sh_info in symbol table");
> ----------------
> davide wrote:
> > ruiu wrote:
> > > Probably `FirstNonLocal == 0` is better as we all know that 0 is not a
> valid symbol index.
> > Agree.
> Do you need this check in here to avoid the crash? How was it crashing
> before getting to the other check you added in Writer?
>
>
> https://reviews.llvm.org/D25016
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160928/d5672c0e/attachment.html>


More information about the llvm-commits mailing list