[llvm] r193737 - Fix a use after free on invalid input.
Rafael Espindola
rafael.espindola at gmail.com
Wed Oct 30 21:20:24 PDT 2013
Author: rafael
Date: Wed Oct 30 23:20:23 2013
New Revision: 193737
URL: http://llvm.org/viewvc/llvm-project?rev=193737&view=rev
Log:
Fix a use after free on invalid input.
Added:
llvm/trunk/test/Bitcode/invalid.ll
llvm/trunk/test/Bitcode/invalid.ll.bc
Modified:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=193737&r1=193736&r2=193737&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Oct 30 23:20:23 2013
@@ -623,11 +623,7 @@ bool BitcodeReader::ParseAttrKind(uint64
*Kind = Attribute::ZExt;
return false;
default:
- std::string Buf;
- raw_string_ostream fmt(Buf);
- fmt << "Unknown attribute kind (" << Code << ")";
- fmt.flush();
- return Error(Buf.c_str());
+ return Error("Unknown attribute kind");
}
}
Added: llvm/trunk/test/Bitcode/invalid.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.ll?rev=193737&view=auto
==============================================================================
--- llvm/trunk/test/Bitcode/invalid.ll (added)
+++ llvm/trunk/test/Bitcode/invalid.ll Wed Oct 30 23:20:23 2013
@@ -0,0 +1,7 @@
+; RUN: not llvm-dis < %s.bc 2>&1 | FileCheck %s
+
+; CHECK: llvm-dis: Unknown attribute kind
+
+; invalid.ll.bc has an invalid attribute number.
+; The test checks that LLVM reports the error and doesn't access freed memory
+; in doing so.
Added: llvm/trunk/test/Bitcode/invalid.ll.bc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.ll.bc?rev=193737&view=auto
==============================================================================
Binary files llvm/trunk/test/Bitcode/invalid.ll.bc (added) and llvm/trunk/test/Bitcode/invalid.ll.bc Wed Oct 30 23:20:23 2013 differ
More information about the llvm-commits
mailing list