[PATCH] D109655: [BitcodeReader] fix a logic error in vector type element validation
William Woodruff via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 11 23:51:19 PDT 2021
woodruffw created this revision.
woodruffw added a reviewer: pcc.
Herald added a subscriber: hiraditya.
woodruffw requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D109655
Files:
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
===================================================================
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1923,7 +1923,7 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109655.372106.patch
Type: text/x-patch
Size: 649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210912/1f9ed2cb/attachment.bin>
More information about the llvm-commits
mailing list