CHECK(stack);
if (ptr == NULL) return 0;
size_t usable_size = malloc_info.AllocationSize((uintptr_t)ptr);
- if (usable_size == 0) {
+ if (FLAG_check_malloc_usable_size && (usable_size == 0)) {
Report("ERROR: AddressSanitizer attempting to call malloc_usable_size() "
"for pointer which is not owned: %p\n", ptr);
stack->PrintStack();
extern int FLAG_sleep_before_dying;
extern bool FLAG_handle_segv;
extern bool FLAG_use_sigaltstack;
+extern bool FLAG_check_malloc_usable_size;
extern int asan_inited;
// Used to avoid infinite recursion in __asan_init().
int FLAG_sleep_before_dying;
bool FLAG_unmap_shadow_on_exit;
bool FLAG_disable_core;
+bool FLAG_check_malloc_usable_size;
// -------------------------- Globals --------------------- {{{1
int asan_inited;
// it makes little sense to dump 16T+ core.
FLAG_disable_core = IntFlagValue(options, "disable_core=", __WORDSIZE == 64);
+ // Allow the users to work around the bug in Nvidia drivers prior to 295.*.
+ FLAG_check_malloc_usable_size =
+ IntFlagValue(options, "check_malloc_usable_size=", 1);
+
FLAG_quarantine_size = IntFlagValue(options, "quarantine_size=",
(ASAN_LOW_MEMORY) ? 1UL << 24 : 1UL << 28);