Z
zachd [MSFT]
Guest
Howdy!
I'm working on an old C++ project in Visual Studio 2019 16.6.3. It was compiling MBCS because ... it's an old project. I decided to add a very simple MfcLink control (IMfcLinkEditor) to my About box. Caption was "https://blahblah/foo", URL was "blahblah/foo", URL Prefix was "https://". This simple change results in a heap corruption every time I close the dialog:
ntdll.dll!_RtlReportCriticalFailure@8() Unknown
ntdll.dll!_RtlpReportHeapFailure@4() Unknown
ntdll.dll!_RtlpLogHeapFailure@24() Unknown
ntdll.dll!_RtlFreeHeap@12() Unknown
kernel32.dll!76ae14ad() Unknown
kernel32.dll![Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] Unknown
MYAPP.exe!_free_base(void * block) Line 105 C++
MYAPP.exe!free(void * block) Line 30 C++
Additionally, when the caption is set to be "random string" it is shown in UI as "random ". Other MBCS string labels are also truncated as would be expected of a math bug.
It's pretty clear that there's code in MfcLink that is hard-wired to expect Unicode values. I can send the solution if needed, but given that I was not doing anything at all interesting with MfcLink it should be trivial to repro this when using MfcLink on a dialog within a MBCS project.
I spent most of today converting everything to Unicode and that does indeed avoid the memory corruption and string truncation, but -- this is a core control and I figured I should point this bug out so that other MBCS users aren't afflicted by it.
Thanks!
Continue reading...
I'm working on an old C++ project in Visual Studio 2019 16.6.3. It was compiling MBCS because ... it's an old project. I decided to add a very simple MfcLink control (IMfcLinkEditor) to my About box. Caption was "https://blahblah/foo", URL was "blahblah/foo", URL Prefix was "https://". This simple change results in a heap corruption every time I close the dialog:
ntdll.dll!_RtlReportCriticalFailure@8() Unknown
ntdll.dll!_RtlpReportHeapFailure@4() Unknown
ntdll.dll!_RtlpLogHeapFailure@24() Unknown
ntdll.dll!_RtlFreeHeap@12() Unknown
kernel32.dll!76ae14ad() Unknown
kernel32.dll![Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] Unknown
MYAPP.exe!_free_base(void * block) Line 105 C++
MYAPP.exe!free(void * block) Line 30 C++
Additionally, when the caption is set to be "random string" it is shown in UI as "random ". Other MBCS string labels are also truncated as would be expected of a math bug.
It's pretty clear that there's code in MfcLink that is hard-wired to expect Unicode values. I can send the solution if needed, but given that I was not doing anything at all interesting with MfcLink it should be trivial to repro this when using MfcLink on a dialog within a MBCS project.
I spent most of today converting everything to Unicode and that does indeed avoid the memory corruption and string truncation, but -- this is a core control and I figured I should point this bug out so that other MBCS users aren't afflicted by it.
Thanks!
Continue reading...