Hey everyone!
I'm having a weird error when debugging the screen recording utility that Martins (mmozieko) wrote and I'm very curious as to what triggers it.
The error comes from the Address Sanitizer in MSVC and it looks like this:
==13576==ERROR: AddressSanitizer: attempting to call malloc_usable_size() for pointer which is not owned: 0x000005b00008 #0 0x1400534ed (.\wcap.exe+0x1400534ed) #1 0x7ffffcda16b6 (C:\WINDOWS\system32\IconCodecService.dll+0x1800016b6) #2 0x7ff834783b37 (C:\WINDOWS\System32\USER32.dll+0x180013b37) #3 0x7ff8347835f8 (C:\WINDOWS\System32\USER32.dll+0x1800135f8) #4 0x7ff834782e59 (C:\WINDOWS\System32\USER32.dll+0x180012e59) #5 0x7ff834785587 (C:\WINDOWS\System32\USER32.dll+0x180015587) #6 0x7ff834781f4c (C:\WINDOWS\System32\USER32.dll+0x180011f4c) #7 0x1400017a3 (.\wcap.exe+0x1400017a3) #8 0x1400746a1 (.\wcap.exe+0x1400746a1) #9 0x1400745fd (.\wcap.exe+0x1400745fd) #10 0x1400744bd (.\wcap.exe+0x1400744bd) #11 0x14007471d (.\wcap.exe+0x14007471d) #12 0x7ff833d8269c (C:\WINDOWS\System32\KERNEL32.DLL+0x18001269c) #13 0x7ff83584a9f7 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x18005a9f7) Address 0x000005b00008 is a wild pointer. SUMMARY: AddressSanitizer: bad-malloc_usable_size (.\wcap.exe+0x1400534ed)
The error occurs after I step over line 1293 in the wcap.c file:
... 1293. gIcon1 = LoadIconW(WindowClass.hInstance, MAKEINTRESOURCEW(1)); 1294. gIcon2 = LoadIconW(WindowClass.hInstance, MAKEINTRESOURCEW(2)); 1295. Assert(gIcon1 && gIcon2); ...
I want to mention that if I turn off the Address Sanitizer then everything works fine and I can keep on debugging.
So if any one of you guys, or even Martins himself, have encountered this odd behavior, I'd very appreciate it if you could shed some light on the matter <3