aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt
diff options
context:
space:
mode:
authorWu Yingcong <yingcong.wu@intel.com>2024-01-21 21:42:38 -0800
committerGitHub <noreply@github.com>2024-01-21 21:42:38 -0800
commit8bef13ef4f59bae481583913a39e5369730effa7 (patch)
tree0f8a75b779309e655806ccb4bf8507c2fb0656f1 /compiler-rt
parent25063bedb596943e546994a45710c79fdd6539e8 (diff)
downloadllvm-8bef13ef4f59bae481583913a39e5369730effa7.zip
llvm-8bef13ef4f59bae481583913a39e5369730effa7.tar.gz
llvm-8bef13ef4f59bae481583913a39e5369730effa7.tar.bz2
[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.
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/hwasan/hwasan_report.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 784cfb9..12a4fa4 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;