[all-commits] [llvm/llvm-project] 05d8ea: [Clang] Prevent null pointer dereferences in SVE t...
smanna12 via All-commits
all-commits at lists.llvm.org
Mon Jul 1 08:51:50 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 05d8ea77c9bbdedc462dadfdcc41332253c1c829
https://github.com/llvm/llvm-project/commit/05d8ea77c9bbdedc462dadfdcc41332253c1c829
Author: smanna12 <soumi.manna at intel.com>
Date: 2024-07-01 (Mon, 01 Jul 2024)
Changed paths:
M clang/lib/CodeGen/CGBuiltin.cpp
Log Message:
-----------
[Clang] Prevent null pointer dereferences in SVE tuple functions (#94267)
This patch
addresses a null pointer dereference issue reported by static analyzer
tool in the
`EmitSVETupleSetOrGet()` and `EmitSVETupleCreate()` functions.
Previously, the function
assumed that the result of `dyn_cast<>` to `ScalableVectorType` would
always be non-null,
which is not guaranteed.
The fix introduces a null check after the `dyn_cast<>` operation. If the
cast fails and
`SingleVecTy` is null, the function now returns `nullptr` to indicate an
error. This prevents the
dereference of a null pointer, which could lead to undefined behavior.
Additionally, the assert message has been corrected to accurately
reflect the expected
conditions.
These changes collectively enhance the robustness of the code by
ensuring type safety and preventing runtime errors due to improper type
casting.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list