[PATCH] D25279: [ELF] - Do not crash on large output.

Rafael Espíndola via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 10:33:44 PDT 2016


On 6 October 2016 at 13:25, Rafael Ávila de Espíndola via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> rafael added inline comments.
>
>
>> Writer.cpp:1223
>>    Off += Sec->getSize();
>> +  if (T > Off)
>> +    fatal("attemp to set offset for " + Sec->getName() +
>
> I wonder how many cases there can be where overflow and if there is a general solution.

I guess if we need to we can create a custom type that uses
llvm.sadd.with.overflow.i32 and call fatal when that returns 1.

I would probably defer it to a second pass if possible. For now lets
try to make sure we don't crash, but not avoid, for example, producing
an truncated file.

Cheers,
Rafael


More information about the llvm-commits mailing list