[compiler-rt] 8bef13e - [hwasan] Fix a possible null dereference problem (#77737)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 21 21:42:42 PST 2024
Author: Wu Yingcong
Date: 2024-01-21T21:42:38-08:00
New Revision: 8bef13ef4f59bae481583913a39e5369730effa7
URL: https://github.com/llvm/llvm-project/commit/8bef13ef4f59bae481583913a39e5369730effa7
DIFF: https://github.com/llvm/llvm-project/commit/8bef13ef4f59bae481583913a39e5369730effa7.diff
LOG: [hwasan] Fix a possible null dereference problem (#77737)
This is clearly a copy-paste mistake, fix it with this patch.
After checking the `local.function_name` is not null, it should check
the len for `local.function_name`, not `local.name`. And this could lead
to possible null dereference since the second
`internal_strlen(local.name)` does not guarantee `local.name` is not
null.
Added:
Modified:
compiler-rt/lib/hwasan/hwasan_report.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 784cfb904aa275..12a4fa47f21519 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -222,7 +222,7 @@ static void PrintStackAllocations(const StackAllocationsRingBuffer *sa,
if (!local.has_frame_offset || !local.has_size || !local.has_tag_offset)
continue;
if (!(local.name && internal_strlen(local.name)) &&
- !(local.function_name && internal_strlen(local.name)) &&
+ !(local.function_name && internal_strlen(local.function_name)) &&
!(local.decl_file && internal_strlen(local.decl_file)))
continue;
tag_t obj_tag = base_tag ^ local.tag_offset;
More information about the llvm-commits
mailing list