Repository navigation
Fix Size type in IntegerOverflow - #39
Conversation
|
Thank you so much for the report.
Correct
This is also correct. However, what will happen when we pass 0xFFFFFFFFFFFFFFFF as the What do you think? Do let me your thoughts. |
|
Thank you for your reply. The type of nInBufferSize of DeviceIoControl (and NtDeviceIoControl) is also defined as DWORD(unsigned long). I confirmed that the following program (and HEVDExploit.exe with 0xFFFFFFFFFFFFFFFF) didn’t cause BSOD before applying this patch and that BSOD occurred after this patch: |
|
@takubokudori yes, I verified and you are correct. Bummer, I didn't consider that Thank you so much for the verification and explanation. Very nice. |
SIZE_T is defined as ULONG_PTR.
ULONG_PTR is defined as unsigned long on x86, but as unsigned __int64 on x64.
Also InputBufferLength is defined as ULONG(unsigned long) on x86 and x64.
So when InputBufferLength is copied to Size in a driver built on x64, an implicit type conversion occurs and it becomes unsigned __int64 type, so even if InputBufferLength is passed 0xFFFFFFFF, it is still an integer overflow will not occur.
This pull request is to fix the issue.