x64dbg / GleeBug

Debugging Framework for Windows.
MIT License
1.2k stars 39 forks source link

ConvertVAtoFileOffsetEx() fails on VA's and crashes client #57

Closed cw2k closed 3 years ago

cw2k commented 3 years ago

That PullReq fixed malfunction in ConvertVAtoFileOffsetEx and avoid possible client crashes due to returning an not expected error value. 4 Changes:

  1. ConvertVAtoFileOffsetEx() fails when the client pass a VA in the AddressToConvert (and sets AddressIsRVA=false to show it). Fix: Added a handler for AddressIsRVA=false that uses the passed Imagebase to turn the VA into a RVA.

  2. ConvertVAtoFileOffsetEx() returned INVALID_VALUE on error. But the client expect 0 in case of an error. Result: INVALID_VALUE was misinterpreted as file offset was crashed the client when writting to the mem mapped location Fix: before returning INVALID_VALUE is turned to 0

  3. ConvertFileOffsetToVA() returned INVALID_VALUE on error.... same story as 2.

  4. implementing 'ReturnType' for ConvertVAtoFileOffsetEx & ConvertFileOffsetToVA

TODO: Also mirgate changes to https://github.com/x64dbg/GleeBug/blob/c5aed9fcccb9f2161af86cfefe0ef5006e913fc9/StaticEngine/Emulator.h#L507

mrexodia commented 3 years ago

Thanks!