[PATCH] [Object, MachO] Don't crash on invalid MachO load commands.

Alexey Samsonov vonosmas at gmail.com
Thu Jun 4 11:38:33 PDT 2015


On Thu, Jun 4, 2015 at 6:23 AM, Rafael EspĂ­ndola <rafael.espindola at gmail.com
> wrote:

> On 4 June 2015 at 03:27, Alexey Samsonov <vonosmas at gmail.com> wrote:
> > I don't know, why should it?
> >
> > llvm-objdump is not documented in http://llvm.org/docs/CommandGuide/,
> and
> > now the behavior of the tool is the same (return 0) for these invalid
> MachO
> > files and missing input files. I agree that we should probably decide and
> > document the behavior of the tool for invalid input, but that seems
> > orthogonal to this change - we just make all the possible failures in
> > constructor uniform.
>
> It is modeled after objdump, and that one exits with non-zero:
>
> objdump  -d Inputs/corrupt.elf-x86-64
> objdump: Inputs/corrupt.elf-x86-64: invalid string offset 1048625 >=
> 75 for section `.shstrtab'
> objdump: Inputs/corrupt.elf-x86-64: invalid string offset 1048625 >=
> 75 for section `.shstrtab'
> objdump: Inputs/corrupt.elf-x86-64: Bad value
> $ echo $?
> 1
>
> IMHO we should not regress that. It should be fixed to check the error
> code first.
>

Agree. r239065.


>
> Cheers,
> Rafael
>



-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150604/dfc11384/attachment.html>


More information about the llvm-commits mailing list