[lsan] [NFC] Change ARRAY_SIZE to internal_strnlen

Calling ARRAY_SIZE on a char* will not actually compute it's size, but just the pointer size.
A new Clang warning enabled by default warns about this.

Replaced the call with internal_strnlen.

Differential Revision: https://reviews.llvm.org/D54484

llvm-svn: 346792
This commit is contained in:
George Karpenkov 2018-11-13 20:19:38 +00:00
parent a92b463955
commit 2e8839de7c
1 changed files with 3 additions and 1 deletions

View File

@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_common/sanitizer_platform.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "lsan_common.h"
#if CAN_SANITIZE_LEAKS && SANITIZER_MAC
@ -116,7 +117,8 @@ static const char *kSkippedSecNames[] = {
// Scans global variables for heap pointers.
void ProcessGlobalRegions(Frontier *frontier) {
for (auto name : kSkippedSecNames) CHECK(ARRAY_SIZE(name) < kMaxSegName);
for (auto name : kSkippedSecNames)
CHECK(internal_strnlen(name, kMaxSegName) < kMaxSegName);
MemoryMappingLayout memory_mapping(false);
InternalMmapVector<LoadedModule> modules;