Skip to content

Commit 25de9d2

Browse files
authored
Update antiasan.c 0513
1 parent deb9a49 commit 25de9d2

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lab5/antiasan.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
// TODO:
2-
void antiasan(unsigned long addr)
3-
{
1+
//TODO
42

3+
void antiasan(unsigned long addr) {
4+
// This offset value (0x7fff8000) is specific to AddressSanitizer (ASan)
5+
// and is used to map main memory addresses to corresponding shadow byte
6+
// addresses in the shadow memory region
7+
8+
// Calculate the shadow byte address
9+
unsigned long shadow_byte_addr = (addr >> 3) + 0x7fff8000;
10+
11+
// Convert the address to a char pointer
12+
char *shadow_byte = (char *)shadow_byte_addr;
13+
14+
// Set the shadow byte to 0
15+
*shadow_byte = 0;
516
}

0 commit comments

Comments
 (0)