Skip to content

Commit 92e234f

Browse files
committed
Fix checks for unsupports HEAP flags.
1 parent b529a69 commit 92e234f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler-rt/lib/asan/asan_malloc_win.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ INTERCEPTOR_WINAPI(LPVOID, HeapAlloc, HANDLE hHeap, DWORD dwFlags,
224224
// In the case that we don't hook the rtl allocators,
225225
// this becomes an assert since there is no failover to the original
226226
// allocator.
227-
CHECK((HEAP_ALLOCATE_UNSUPPORTED_FLAGS & dwFlags) != 0 &&
227+
CHECK((HEAP_ALLOCATE_UNSUPPORTED_FLAGS & dwFlags) == 0 &&
228228
"unsupported flags");
229229
}
230230
GET_STACK_TRACE_MALLOC;
@@ -249,7 +249,7 @@ INTERCEPTOR_WINAPI(BOOL, HeapFree, HANDLE hHeap, DWORD dwFlags, LPVOID lpMem) {
249249
if (OWNED_BY_RTL(hHeap, lpMem))
250250
return REAL(HeapFree)(hHeap, dwFlags, lpMem);
251251
} else {
252-
CHECK((HEAP_FREE_UNSUPPORTED_FLAGS & dwFlags) != 0 && "unsupported flags");
252+
CHECK((HEAP_FREE_UNSUPPORTED_FLAGS & dwFlags) == 0 && "unsupported flags");
253253
}
254254
GET_STACK_TRACE_FREE;
255255
asan_free(lpMem, &stack, FROM_MALLOC);
@@ -356,7 +356,7 @@ void *SharedReAlloc(ReAllocFunction reallocFunc, SizeFunction heapSizeFunc,
356356
// Pass through even when it's neither since this could be a null realloc or
357357
// UAF that ASAN needs to catch.
358358
} else {
359-
CHECK((HEAP_REALLOC_UNSUPPORTED_FLAGS & dwFlags) != 0 &&
359+
CHECK((HEAP_REALLOC_UNSUPPORTED_FLAGS & dwFlags) == 0 &&
360360
"unsupported flags");
361361
}
362362
// asan_realloc will never reallocate in place, so for now this flag is

0 commit comments

Comments
 (0)