Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
compiler-rt/lib/asan/asan_errors.cc
Show First 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | if (access_size) { | ||||
// Determine the error type. | // Determine the error type. | ||||
bug_descr = "unknown-crash"; | bug_descr = "unknown-crash"; | ||||
if (AddrIsInMem(addr)) { | if (AddrIsInMem(addr)) { | ||||
u8 *shadow_addr = (u8 *)MemToShadow(addr); | u8 *shadow_addr = (u8 *)MemToShadow(addr); | ||||
// If we are accessing 16 bytes, look at the second shadow byte. | // If we are accessing 16 bytes, look at the second shadow byte. | ||||
if (*shadow_addr == 0 && access_size > SHADOW_GRANULARITY) shadow_addr++; | if (*shadow_addr == 0 && access_size > SHADOW_GRANULARITY) shadow_addr++; | ||||
// If we are in the partial right redzone, look at the next shadow byte. | // If we are in the partial right redzone, look at the next shadow byte. | ||||
if (*shadow_addr > 0 && *shadow_addr < 128) shadow_addr++; | if (*shadow_addr > 0 && *shadow_addr < 128) shadow_addr++; | ||||
// For large shadow granularity, skip pass all partial right redzones. | |||||
if (SHADOW_GRANULARITY >= 32) { | |||||
while (AddrIsInShadow((uptr)shadow_addr) && *shadow_addr > 0 && | |||||
*shadow_addr < 128) | |||||
shadow_addr++; | |||||
} | |||||
bool far_from_bounds = false; | bool far_from_bounds = false; | ||||
shadow_val = *shadow_addr; | shadow_val = *shadow_addr; | ||||
int bug_type_score = 0; | int bug_type_score = 0; | ||||
// For use-after-frees reads are almost as bad as writes. | // For use-after-frees reads are almost as bad as writes. | ||||
int read_after_free_bonus = 0; | int read_after_free_bonus = 0; | ||||
switch (shadow_val) { | switch (shadow_val) { | ||||
case kAsanHeapLeftRedzoneMagic: | case kAsanHeapLeftRedzoneMagic: | ||||
case kAsanArrayCookieMagic: | case kAsanArrayCookieMagic: | ||||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |