diff options
Diffstat (limited to 'libsanitizer/asan')
-rw-r--r-- | libsanitizer/asan/asan_flags.inc | 6 | ||||
-rw-r--r-- | libsanitizer/asan/asan_report.cc | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libsanitizer/asan/asan_flags.inc b/libsanitizer/asan/asan_flags.inc index 3784f06..b4253e0 100644 --- a/libsanitizer/asan/asan_flags.inc +++ b/libsanitizer/asan/asan_flags.inc @@ -134,9 +134,9 @@ ASAN_FLAG( "Android. ") ASAN_FLAG( int, detect_invalid_pointer_pairs, 0, - "If non-zero, try to detect operations like <, <=, >, >= and - on " - "invalid pointer pairs (e.g. when pointers belong to different objects). " - "The bigger the value the harder we try.") + "If >= 2, detect operations like <, <=, >, >= and - on invalid pointer " + "pairs (e.g. when pointers belong to different objects); " + "If == 1, detect invalid operations only when both pointers are non-null.") ASAN_FLAG( bool, detect_container_overflow, true, "If true, honor the container overflow annotations. See " diff --git a/libsanitizer/asan/asan_report.cc b/libsanitizer/asan/asan_report.cc index 261ec1a..434aa73 100644 --- a/libsanitizer/asan/asan_report.cc +++ b/libsanitizer/asan/asan_report.cc @@ -340,7 +340,11 @@ static bool IsInvalidPointerPair(uptr a1, uptr a2) { } static INLINE void CheckForInvalidPointerPair(void *p1, void *p2) { - if (!flags()->detect_invalid_pointer_pairs) return; + switch (flags()->detect_invalid_pointer_pairs) { + case 0 : return; + case 1 : if (p1 == nullptr || p2 == nullptr) return; break; + } + uptr a1 = reinterpret_cast<uptr>(p1); uptr a2 = reinterpret_cast<uptr>(p2); |