1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Fix a use after free on invalid input.

llvm-svn: 193737
This commit is contained in:
Rafael Espindola 2013-10-31 04:20:23 +00:00
parent c68d6e85ef
commit 971db84e8e
3 changed files with 8 additions and 5 deletions

View File

@ -623,11 +623,7 @@ bool BitcodeReader::ParseAttrKind(uint64_t Code, Attribute::AttrKind *Kind) {
*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");
}
}

7
test/Bitcode/invalid.ll Normal file
View File

@ -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.

BIN
test/Bitcode/invalid.ll.bc Normal file

Binary file not shown.