I'm currently at a point that requires me to decode an encrypted QByteArray but in my case it is possible for the passed data to be invalid.
If I now pass this invalid data through the decode() method the entire app crashes, giving me the following error:
HEAP[MyApp.exe]: Heap block at 000001DA7A1C7B10 modified at 000001DA7A1C7B70 past requested size of 50
HEAP[MyApp.exe]: Invalid address specified to RtlValidateHeap( 000001DA706F0000, 000001DA7A1C7B20 )
Debug Assertion Failed!
Program: ...sktop_Qt_5_12_8_MSVC2017_64bit-Debug\debug\MyApp.exe
File: minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp
Line: 904
Expression: _CrtIsValidHeapPointer(block)
Using a try {} catch {} doesn't work, since the error seems to corrupt the heap in some way.
I know I should fix the source of the problem rather than trying to fix the symptoms but I don't see a bulletproof way to do this in my case.
- My suggestion is to add a function / method that checks the validity of a passed (encoded) QByteArray, which can either directly be implemented in the
decode() method or run by the user themselves prior to decoding if needed.
- An alternative solution is to make the
decode() method just throw a catch-able Error when the passed data is invalid.
Technical Details:
- Qt v5.14.2
- Qt-AES v1.1
- OS: Windows 10 (1909)
- Compiler: MSVC 2017 64bit
I'm currently at a point that requires me to decode an encrypted QByteArray but in my case it is possible for the passed data to be invalid.
If I now pass this invalid data through the
decode()method the entire app crashes, giving me the following error:Using a
try {} catch {}doesn't work, since the error seems to corrupt the heap in some way.I know I should fix the source of the problem rather than trying to fix the symptoms but I don't see a bulletproof way to do this in my case.
decode()method or run by the user themselves prior to decoding if needed.decode()method just throw a catch-able Error when the passed data is invalid.Technical Details: