From: Florian Hahn Date: Thu, 11 Jul 2019 10:53:40 +0000 (+0000) Subject: Revert [BitcodeReader] Validate OpNum, before accessing Record array. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4f3a95e57a4a46648f790e5065bed0e64fe98d64;p=llvm Revert [BitcodeReader] Validate OpNum, before accessing Record array. This reverts r365750 (git commit 8b222ecf2769ee133691f208f6166ce118c4a164) llvm-dis runs out of memory while opening invalid-fcmp-opnum.bc on llvm-hexagon-elf, probably because the bitcode file contains other suspicious values. http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/21949 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365757 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 0d302b7dfaa..0ba76f0f371 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -4165,10 +4165,6 @@ Error BitcodeReader::parseFunctionBody(Function *F) { popValue(Record, OpNum, NextValueNo, LHS->getType(), RHS)) return error("Invalid record"); - if (OpNum >= Record.size()) - return error( - "Invalid record: operand number exceeded available operands"); - unsigned PredVal = Record[OpNum]; bool IsFP = LHS->getType()->isFPOrFPVectorTy(); FastMathFlags FMF; diff --git a/test/Bitcode/Inputs/invalid-fcmp-opnum.bc b/test/Bitcode/Inputs/invalid-fcmp-opnum.bc deleted file mode 100644 index 454a14b8611..00000000000 Binary files a/test/Bitcode/Inputs/invalid-fcmp-opnum.bc and /dev/null differ diff --git a/test/Bitcode/invalid.test b/test/Bitcode/invalid.test index d1f9d7c0874..2a9af0626c6 100644 --- a/test/Bitcode/invalid.test +++ b/test/Bitcode/invalid.test @@ -235,8 +235,3 @@ RUN: not llvm-dis -disable-output %p/Inputs/invalid-nonpointer-atomicrmw.bc 2>&1 RUN: FileCheck --check-prefix=NONPOINTER-ATOMICRMW %s NONPOINTER-ATOMICRMW: Invalid record - -RUN: not llvm-dis -disable-output %p/Inputs/invalid-fcmp-opnum.bc 2>&1 | \ -RUN: FileCheck --check-prefix=INVALID-FCMP-OPNUM %s - -INVALID-FCMP-OPNUM: Invalid record: operand number exceeded available operands