[llvm] r263742 - Bitcode: Error out instead of crashing on corrupt metadata

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 14:55:15 PDT 2016


On 17 March 2016 at 13:12, Justin Bogner via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: bogner
> Date: Thu Mar 17 15:12:06 2016
> New Revision: 263742
>
> URL: http://llvm.org/viewvc/llvm-project?rev=263742&view=rev
> Log:
> Bitcode: Error out instead of crashing on corrupt metadata
>
> I hit a crash in the bitcode reader on some corrupt input where an
> MDString had somehow been attached to an instruction instead of an
> MDNode. This input is pretty bogus, but we shouldn't be crashing on bad
> input here.
>
> This change adds error handling in all of the places where we
> currently have unchecked casts from Metadata to MDNode, which means
> we'll error out instead of crashing for that sort of input.
>
> Unfortunately, I don't have tests. Hitting this requires flipping bits
> in the input bitcode, and committing corrupt binary files to catch
> these cases is a bit too opaque and unmaintainable.

IMHO not having tests is even more unmaintainable.

Cheers,
Rafael


More information about the llvm-commits mailing list