From 778bf73d7ba693f4bb74d137a70870bce128a19f Mon Sep 17 00:00:00 2001 From: william woodruff Date: Sat, 9 Oct 2021 08:59:45 +0530 Subject: [BitcodeReader] fix a logic error in vector type element validation The current code checks whether the vector's element type is a valid structure element type, rather than a valid vector element type. The two have separate implementations and but only accept very slightly different sets of types, which is probably why this wasn't caught before. Differential Revision: https://reviews.llvm.org/D109655 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index f5503d6..b3df3a7 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1926,7 +1926,7 @@ Error BitcodeReader::parseTypeTableBody() { if (Record[0] == 0) return error("Invalid vector length"); ResultTy = getTypeByID(Record[1]); - if (!ResultTy || !StructType::isValidElementType(ResultTy)) + if (!ResultTy || !VectorType::isValidElementType(ResultTy)) return error("Invalid type"); bool Scalable = Record.size() > 2 ? Record[2] : false; ResultTy = VectorType::get(ResultTy, Record[0], Scalable); -- cgit v1.1