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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Jun 4 06:23:18 PDT 2015


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.

Cheers,
Rafael



More information about the llvm-commits mailing list