We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent deb9a49 commit 25de9d2Copy full SHA for 25de9d2
lab5/antiasan.c
@@ -1,5 +1,16 @@
1
-// TODO:
2
-void antiasan(unsigned long addr)
3
-{
+//TODO
4
+void antiasan(unsigned long addr) {
+ // 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;
16
}
0 commit comments