[llvm] ed07fc8 - [Bitcode] Add missing getValue() return value checks

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 03:37:12 PST 2023


Author: Nikita Popov
Date: 2023-12-11T12:37:05+01:00
New Revision: ed07fc809c371825ade9cba99966c23b0f23e868

URL: https://github.com/llvm/llvm-project/commit/ed07fc809c371825ade9cba99966c23b0f23e868
DIFF: https://github.com/llvm/llvm-project/commit/ed07fc809c371825ade9cba99966c23b0f23e868.diff

LOG: [Bitcode] Add missing getValue() return value checks

Added: 
    

Modified: 
    llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 9d7e838733b5a0..98c5e948dc5960 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -5363,6 +5363,8 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
       Type *TokenTy = Type::getTokenTy(Context);
       Value *ParentPad = getValue(Record, Idx++, NextValueNo, TokenTy,
                                   getVirtualTypeID(TokenTy), CurBB);
+      if (!ParentPad)
+        return error("Invalid record");
 
       unsigned NumHandlers = Record[Idx++];
 
@@ -5404,6 +5406,8 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
       Type *TokenTy = Type::getTokenTy(Context);
       Value *ParentPad = getValue(Record, Idx++, NextValueNo, TokenTy,
                                   getVirtualTypeID(TokenTy), CurBB);
+      if (!ParentPad)
+        return error("Invald record");
 
       unsigned NumArgOperands = Record[Idx++];
 


        


More information about the llvm-commits mailing list