You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a protected app/program some of the Descriptor contains invalid value resulting to a crash due to access violation, seems to start with a Descriptor that is filled with zeroes (0x00)
Adding these lines should be able to prevent the crash.
constchar* ImportDLLName = (constchar*)BaseAddress + Descriptor->Name;
// On a packed/protected program, some of the descriptors might contains an invalid data (feels like exceeding the actual number of import descriptors), zero-filled Descriptor seems to be used as terminator.if (!Descriptor->Name || !Descriptor->FirstThunk)
break;
The text was updated successfully, but these errors were encountered:
Thanks, have you tested if the rest of the array is safe, or it just stops from the offending entry?
I am thinking of replacing the break; in your code with a continue to basically just skip the mangled entry.
The rest of the descriptors after the one filled with all zeroes seems to contains random junk which is an invalid memory address and resulting to access violation when used on strcmp
i've tried using continue and still crashing, i even tried to wrapped it with try..catch but nothing useful being printed after the terminating descriptor (the one filled with all zeroes).
...
WINTRUST.dll
WLDAP32.dll
WS2_32.dll <-- this is the last valid name right before the one filled with all zeroes
MZ� <-- this is the descriptor right after the one filled with all zeroes
MZ�
PS: Might be better to check the whole content of the Descriptor whether it's all zeroes or not as termination indicator, instead of partially by field, like:
unsignedchar* mm = (unsignedchar*)Descriptor;
if ((*mm == 0) && memcmp(mm, mm + 1, sizeof(IMAGE_IMPORT_DESCRIPTOR) - 1) == 0)
break;
DInput8HookingExample/MinimalDInput8Hook/Hook.cpp
Line 36 in b9b7e79
On a protected app/program some of the Descriptor contains invalid value resulting to a crash due to access violation, seems to start with a Descriptor that is filled with zeroes (0x00)
Adding these lines should be able to prevent the crash.
The text was updated successfully, but these errors were encountered: