[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.
This commit is contained in:
Wu Yingcong 2024-01-21 21:42:38 -08:00 committed by GitHub
parent 25063bedb5
commit 8bef13ef4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;