[llvm] r365757 - Revert [BitcodeReader] Validate OpNum, before accessing Record array.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 03:53:40 PDT 2019


Author: fhahn
Date: Thu Jul 11 03:53:40 2019
New Revision: 365757

URL: http://llvm.org/viewvc/llvm-project?rev=365757&view=rev
Log:
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

Removed:
    llvm/trunk/test/Bitcode/Inputs/invalid-fcmp-opnum.bc
Modified:
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/test/Bitcode/invalid.test

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=365757&r1=365756&r2=365757&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Thu Jul 11 03:53:40 2019
@@ -4165,10 +4165,6 @@ Error BitcodeReader::parseFunctionBody(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;

Removed: llvm/trunk/test/Bitcode/Inputs/invalid-fcmp-opnum.bc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/Inputs/invalid-fcmp-opnum.bc?rev=365756&view=auto
==============================================================================
Binary file - no diff available.

Modified: llvm/trunk/test/Bitcode/invalid.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.test?rev=365757&r1=365756&r2=365757&view=diff
==============================================================================
--- llvm/trunk/test/Bitcode/invalid.test (original)
+++ llvm/trunk/test/Bitcode/invalid.test Thu Jul 11 03:53:40 2019
@@ -235,8 +235,3 @@ RUN: not llvm-dis -disable-output %p/Inp
 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




More information about the llvm-commits mailing list