diff options
author | Wu Yingcong <yingcong.wu@intel.com> | 2024-01-21 21:42:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-21 21:42:38 -0800 |
commit | 8bef13ef4f59bae481583913a39e5369730effa7 (patch) | |
tree | 0f8a75b779309e655806ccb4bf8507c2fb0656f1 /compiler-rt | |
parent | 25063bedb596943e546994a45710c79fdd6539e8 (diff) | |
download | llvm-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.cpp | 2 |
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; |