23
23
#include < memory>
24
24
#include < type_traits>
25
25
26
- #include " absl/base/attributes.h"
27
- #include " absl/types/span.h"
28
26
#include " ./fuzztest/internal/logging.h"
29
27
#include " ./fuzztest/internal/table_of_recent_compares.h"
28
+ #include " absl/base/attributes.h"
29
+ #include " absl/types/span.h"
30
30
31
31
namespace fuzztest ::internal {
32
32
namespace {
@@ -268,8 +268,7 @@ extern "C" void __sanitizer_cov_8bit_counters_init(uint8_t* start,
268
268
// This function should have no external library dependencies to prevent
269
269
// accidental coverage instrumentation.
270
270
template <int data_size>
271
- ABSL_ATTRIBUTE_ALWAYS_INLINE // To make __builtin_return_address(0) work.
272
- GOOGLEFUZZTEST_NOSANITIZE // To skip arg1 - arg2 overflow.
271
+ GOOGLEFUZZTEST_NOSANITIZE // To skip arg1 - arg2 overflow.
273
272
void
274
273
TraceCmp (uint64_t arg1, uint64_t arg2, uint8_t argsize_bit,
275
274
uintptr_t PC =
@@ -288,7 +287,7 @@ ABSL_ATTRIBUTE_ALWAYS_INLINE // To make __builtin_return_address(0) work.
288
287
289
288
// Use NO_SANITIZE_MEMORY and ADDRESS to skip possible errors on reading buffer.
290
289
GOOGLEFUZZTEST_NOSANITIZE
291
- static size_t InternalStrnlen (const char * s, size_t n) {
290
+ static size_t InternalStrnlen (const char * s, size_t n) {
292
291
size_t len = 0 ;
293
292
while (len < n && s[len]) {
294
293
len++;
@@ -297,7 +296,7 @@ static size_t InternalStrnlen(const char *s, size_t n) {
297
296
}
298
297
299
298
GOOGLEFUZZTEST_NOSANITIZE
300
- static size_t InternalStrlen (const char * s1, const char * s2) {
299
+ static size_t InternalStrlen (const char * s1, const char * s2) {
301
300
size_t len = 0 ;
302
301
while (s1[len] && s2[len]) {
303
302
len++;
@@ -306,7 +305,7 @@ static size_t InternalStrlen(const char *s1, const char *s2) {
306
305
}
307
306
308
307
GOOGLEFUZZTEST_NOSANITIZE
309
- static void TraceMemCmp (const uint8_t * s1, const uint8_t * s2, size_t n,
308
+ static void TraceMemCmp (const uint8_t * s1, const uint8_t * s2, size_t n,
310
309
int result) {
311
310
// Non-interesting cases.
312
311
if (n <= 1 || result == 0 ) return ;
@@ -345,7 +344,7 @@ void __sanitizer_cov_trace_cmp8(uint64_t Arg1, uint64_t Arg2) {
345
344
}
346
345
347
346
GOOGLEFUZZTEST_NOSANITIZE
348
- void __sanitizer_cov_trace_switch (uint64_t Val, uint64_t * Cases) {
347
+ void __sanitizer_cov_trace_switch (uint64_t Val, uint64_t * Cases) {
349
348
uintptr_t PC = reinterpret_cast <uintptr_t >(__builtin_return_address (0 ));
350
349
switch (Cases[0 ]) {
351
350
case 8 :
@@ -374,45 +373,45 @@ void __sanitizer_cov_trace_switch(uint64_t Val, uint64_t *Cases) {
374
373
}
375
374
376
375
GOOGLEFUZZTEST_NOSANITIZE
377
- void __sanitizer_weak_hook_strcasecmp (void *, const char * s1, const char * s2,
376
+ void __sanitizer_weak_hook_strcasecmp (void *, const char * s1, const char * s2,
378
377
int result) {
379
378
if (s1 == nullptr || s2 == nullptr ) return ;
380
379
size_t n = InternalStrlen (s1, s2);
381
- TraceMemCmp (reinterpret_cast <const uint8_t *>(s1),
382
- reinterpret_cast <const uint8_t *>(s2), n, result);
380
+ TraceMemCmp (reinterpret_cast <const uint8_t *>(s1),
381
+ reinterpret_cast <const uint8_t *>(s2), n, result);
383
382
}
384
383
385
384
GOOGLEFUZZTEST_NOSANITIZE
386
- void __sanitizer_weak_hook_memcmp (void *, const void * s1, const void * s2,
385
+ void __sanitizer_weak_hook_memcmp (void *, const void * s1, const void * s2,
387
386
size_t n, int result) {
388
387
if (s1 == nullptr || s2 == nullptr ) return ;
389
- TraceMemCmp (reinterpret_cast <const uint8_t *>(s1),
390
- reinterpret_cast <const uint8_t *>(s2), n, result);
388
+ TraceMemCmp (reinterpret_cast <const uint8_t *>(s1),
389
+ reinterpret_cast <const uint8_t *>(s2), n, result);
391
390
}
392
391
393
392
GOOGLEFUZZTEST_NOSANITIZE
394
- void __sanitizer_weak_hook_strncmp (void *, const char * s1, const char * s2,
393
+ void __sanitizer_weak_hook_strncmp (void *, const char * s1, const char * s2,
395
394
size_t n, int result) {
396
395
if (s1 == nullptr || s2 == nullptr ) return ;
397
396
size_t len1 = InternalStrnlen (s1, n);
398
397
size_t len2 = InternalStrnlen (s2, n);
399
398
n = std::min (std::min (n, len1), len2);
400
- TraceMemCmp (reinterpret_cast <const uint8_t *>(s1),
401
- reinterpret_cast <const uint8_t *>(s2), n, result);
399
+ TraceMemCmp (reinterpret_cast <const uint8_t *>(s1),
400
+ reinterpret_cast <const uint8_t *>(s2), n, result);
402
401
}
403
402
404
403
GOOGLEFUZZTEST_NOSANITIZE
405
- void __sanitizer_weak_hook_strcmp (void *, const char * s1, const char * s2,
404
+ void __sanitizer_weak_hook_strcmp (void *, const char * s1, const char * s2,
406
405
int result) {
407
406
if (s1 == nullptr || s2 == nullptr ) return ;
408
407
size_t n = InternalStrlen (s1, s2);
409
- TraceMemCmp (reinterpret_cast <const uint8_t *>(s1),
410
- reinterpret_cast <const uint8_t *>(s2), n, result);
408
+ TraceMemCmp (reinterpret_cast <const uint8_t *>(s1),
409
+ reinterpret_cast <const uint8_t *>(s2), n, result);
411
410
}
412
411
413
412
GOOGLEFUZZTEST_NOSANITIZE
414
- void __sanitizer_weak_hook_strncasecmp (void * caller_pc, const char * s1,
415
- const char * s2, size_t n, int result) {
413
+ void __sanitizer_weak_hook_strncasecmp (void * caller_pc, const char * s1,
414
+ const char * s2, size_t n, int result) {
416
415
if (s1 == nullptr || s2 == nullptr ) return ;
417
416
return __sanitizer_weak_hook_strncmp (caller_pc, s1, s2, n, result);
418
417
}
0 commit comments