<div dir="ltr">This test will fail when someone adds a new attribute, like inalloca. I'm going to move the invalid attribute bitcode out to 48 instead of just 38.</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Oct 30, 2013 at 9:20 PM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: rafael<br>
Date: Wed Oct 30 23:20:23 2013<br>
New Revision: 193737<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=193737&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=193737&view=rev</a><br>
Log:<br>
Fix a use after free on invalid input.<br>
<br>
Added:<br>
llvm/trunk/test/Bitcode/invalid.ll<br>
llvm/trunk/test/Bitcode/invalid.ll.bc<br>
Modified:<br>
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp<br>
<br>
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=193737&r1=193736&r2=193737&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=193737&r1=193736&r2=193737&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)<br>
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Oct 30 23:20:23 2013<br>
@@ -623,11 +623,7 @@ bool BitcodeReader::ParseAttrKind(uint64<br>
*Kind = Attribute::ZExt;<br>
return false;<br>
default:<br>
- std::string Buf;<br>
- raw_string_ostream fmt(Buf);<br>
- fmt << "Unknown attribute kind (" << Code << ")";<br>
- fmt.flush();<br>
- return Error(Buf.c_str());<br>
+ return Error("Unknown attribute kind");<br>
}<br>
}<br>
<br>
<br>
Added: llvm/trunk/test/Bitcode/invalid.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.ll?rev=193737&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.ll?rev=193737&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/Bitcode/invalid.ll (added)<br>
+++ llvm/trunk/test/Bitcode/invalid.ll Wed Oct 30 23:20:23 2013<br>
@@ -0,0 +1,7 @@<br>
+; RUN: not llvm-dis < %s.bc 2>&1 | FileCheck %s<br>
+<br>
+; CHECK: llvm-dis: Unknown attribute kind<br>
+<br>
+; invalid.ll.bc has an invalid attribute number.<br>
+; The test checks that LLVM reports the error and doesn't access freed memory<br>
+; in doing so.<br>
<br>
Added: llvm/trunk/test/Bitcode/invalid.ll.bc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.ll.bc?rev=193737&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/invalid.ll.bc?rev=193737&view=auto</a><br>
==============================================================================<br>
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<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>