[llvm] r236076 - Turn an assert into report_fatal_error since it's reachable based on user input
Filipe Cabecinhas
me at filcab.net
Tue Apr 28 18:58:31 PDT 2015
Author: filcab
Date: Tue Apr 28 20:58:31 2015
New Revision: 236076
URL: http://llvm.org/viewvc/llvm-project?rev=236076&view=rev
Log:
Turn an assert into report_fatal_error since it's reachable based on user input
Bug found with AFL fuzz.
Added:
llvm/trunk/test/Bitcode/Inputs/invalid-array-op-not-2nd-to-last.bc
Modified:
llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp
llvm/trunk/test/Bitcode/invalid.test
Modified: llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp?rev=236076&r1=236075&r2=236076&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp Tue Apr 28 20:58:31 2015
@@ -199,7 +199,8 @@ unsigned BitstreamCursor::readRecord(uns
unsigned NumElts = ReadVBR(6);
// Get the element encoding.
- assert(i+2 == e && "array op not second to last?");
+ if (i+2 != e)
+ report_fatal_error("Array op not second to last");
const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i);
if (EltEnc.getEncoding() == BitCodeAbbrevOp::Array ||
EltEnc.getEncoding() == BitCodeAbbrevOp::Blob)
Added: llvm/trunk/test/Bitcode/Inputs/invalid-array-op-not-2nd-to-last.bc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/Inputs/invalid-array-op-not-2nd-to-last.bc?rev=236076&view=auto
==============================================================================
Binary files llvm/trunk/test/Bitcode/Inputs/invalid-array-op-not-2nd-to-last.bc (added) and llvm/trunk/test/Bitcode/Inputs/invalid-array-op-not-2nd-to-last.bc Tue Apr 28 20:58:31 2015 differ
Modified: llvm/trunk/test/Bitcode/invalid.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.test?rev=236076&r1=236075&r2=236076&view=diff
==============================================================================
--- llvm/trunk/test/Bitcode/invalid.test (original)
+++ llvm/trunk/test/Bitcode/invalid.test Tue Apr 28 20:58:31 2015
@@ -105,3 +105,8 @@ RUN: not llvm-dis -disable-output %p/Inp
RUN: FileCheck --check-prefix=ELEMENT-TYPE %s
ELEMENT-TYPE: Invalid type
+
+RUN: not llvm-dis -disable-output %p/Inputs/invalid-array-op-not-2nd-to-last.bc 2>&1 | \
+RUN: FileCheck --check-prefix=ARRAY-NOT-2LAST %s
+
+ARRAY-NOT-2LAST: Array op not second to last
More information about the llvm-commits
mailing list