From 44a7190b7aaefbac6269996006409b7adc2e60ad Mon Sep 17 00:00:00 2001 From: _ <🐱> Date: Thu, 3 Dec 2020 16:57:32 -0700 Subject: [PATCH] Fix potential crashes from bad pointers (typically after ads) --- SpotifyKeyDumper/Hooks.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SpotifyKeyDumper/Hooks.cpp b/SpotifyKeyDumper/Hooks.cpp index c156e72..3531a62 100644 --- a/SpotifyKeyDumper/Hooks.cpp +++ b/SpotifyKeyDumper/Hooks.cpp @@ -200,6 +200,10 @@ int* __fastcall log_hook_v45(void* This, void* _EDX, int a2, int a3, void* a4, c void __fastcall fileIdWriter_hook_v45(void* This, void* _EDX, int* a2) { + // Program sometimes crashes after ads. Could possibly be due to bad pointers + if (Utils::BadPtr(a2) || Utils::BadPtr(a2 + 16) || Utils::BadPtr((char*)*(DWORD*)(a2 + 16))) + return; + // [[ebp+8]+28] char* fileId = (char*) *(DWORD*)(a2 + 16); // 0x40 / 4 = 16 ::fileId = std::string(fileId);