diff options
author | Manna, Soumi <soumi.manna@intel.com> | 2023-05-23 07:22:40 -0700 |
---|---|---|
committer | Manna, Soumi <soumi.manna@intel.com> | 2023-05-23 07:25:21 -0700 |
commit | cc6a6c48d4bb498717950ae482167102d25bf821 (patch) | |
tree | e1714cadd0336bf221c1be752d90b5a1eb531fdb /llvm/lib/IR/Module.cpp | |
parent | 42d9742752d4da5db2863c1ec11d6a61fdb85109 (diff) | |
download | llvm-cc6a6c48d4bb498717950ae482167102d25bf821.zip llvm-cc6a6c48d4bb498717950ae482167102d25bf821.tar.gz llvm-cc6a6c48d4bb498717950ae482167102d25bf821.tar.bz2 |
[NFC][Clang] Fix Coverity bug with dereference null return value in clang::CodeGen::CodeGenFunction::EmitOMPArraySectionExpr()
Reported by Coverity:
Inside "CGExpr.cpp" file, in clang::CodeGen::CodeGenFunction::EmitOMPArraySectionExpr(clang::OMPArraySectionExpr const *, bool): Return value of function which returns null is dereferenced without checking.
} else {
//returned_null: getAsConstantArrayType returns nullptr (checked 83 out of 95 times).
// var_assigned: Assigning: CAT = nullptr return value from getAsConstantArrayType.
auto *CAT = C.getAsConstantArrayType(ArrayTy);
//identity_transfer: Member function call CAT->getSize() returns an offset off CAT (this).
// Dereference null return value (NULL_RETURNS)
//dereference: Dereferencing a pointer that might be nullptr CAT->getSize() when calling APInt.
ConstLength = CAT->getSize();
}
This patch adds an assert to resolve the bug.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D151137
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
0 files changed, 0 insertions, 0 deletions