dscharrer / innoextract

A tool to unpack installers created by Inno Setup
https://constexpr.org/innoextract/
Other
1k stars 125 forks source link

Heap corruption in MSVC build. #99

Closed lazyhamster closed 4 years ago

lazyhamster commented 4 years ago

I've tried to build current master branch in Visual Studio 2017 but ran into problem. Newly built program crashes instantly. Looks like heap becomes corrupted.

Message from debugger:

HEAP[innoextract.exe]: Invalid address specified to RtlValidateHeap( 014A0000, 00F0ADE0 )
innoextract.exe has triggered a breakpoint.

Debug Assertion Failed!

Program: C:\Temp\cmake-build\Debug\innoextract.exe
File: minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp
Line: 904

Expression: _CrtIsValidHeapPointer(block)

After some code commenting I've found offending line in main function:

boost::filesystem::path::imbue(std::locale(std::locale(), &util::codecvt));

Commenting it or replacing with something simpler like

boost::filesystem::path::imbue(std::locale());

fixes the problem and program runs properly

dscharrer commented 4 years ago

Probably related to issue #76. I plan to replace boost::filesystem for the next release so this code will no longer be used.

Using boost::filesystem::path::imbue(std::locale()); will break the encoding for filenames with non-ASCII characters unless you have the windows code-page set to UTF-8 which is only possible with recent versions of Windows 10.

ofry commented 4 years ago

@dscharrer After googling, I found https://stackoverflow.com/questions/32272959/boostfilesystempathimbue-failed-with-default-stdlocale

ofry commented 4 years ago

@dscharrer Is it helpful?

dscharrer commented 4 years ago

This should be fixed with version 1.9.

Thanks for looking into this @ofry.