]> granicus.if.org Git - llvm/commit
[BitcodeReader] Validate OpNum, before accessing Record array.
authorFlorian Hahn <flo@fhahn.com>
Thu, 11 Jul 2019 09:57:00 +0000 (09:57 +0000)
committerFlorian Hahn <flo@fhahn.com>
Thu, 11 Jul 2019 09:57:00 +0000 (09:57 +0000)
commit4af77dd891ccbe696a23d58b6cd8194d337a0ab1
tree327aca73eb86b0861848d6fb3327d72a7bf81b27
parent3423b03f7bd975f41d102f2a8ef01ce28db11672
[BitcodeReader] Validate OpNum, before accessing Record array.

Currently invalid bitcode files can cause a crash, when OpNum exceeds
the number of elements in Record, like in the attached bitcode file.

The test case was generated by clusterfuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15698

Reviewers: t.p.northover, thegameg, jfb

Reviewed By: jfb

Differential Revision: https://reviews.llvm.org/D64507

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365750 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Bitcode/Reader/BitcodeReader.cpp
test/Bitcode/Inputs/invalid-fcmp-opnum.bc [new file with mode: 0644]
test/Bitcode/invalid.test