I have a zip file, which is corrupted in some way (it is attached). It can be un-zipped via Windows Explorer, but a "zip -T" on Ubuntu
results in a report that the file is corrupt. That is OK.
My problem is that it results in a crash in wxZipInputStream::OpenEntry(...). I would have expected it to report a fail
or something instead.
Here is a snippet of code showing the problem:
Code: Select all
wxFileInputStream* inputStream = new wxFileInputStream("C:\\tmp\\EjectInsert.Xcyto10.zip");
wxZipInputStream* zipStream = new wxZipInputStream(*inputStream);
bool ok = zipStream->IsOk();
wxZipEntry* pNext = zipStream->GetNextEntry();
if (ok && pNext!=NULL && zipStream->OpenEntry(*pNext)) // <--- crash in OpenEntry(...)
{
// More stuff
}
Code: Select all
wxZipHeader::wxZipHeader(const char* data, size_t size)
: m_size(size),
m_pos(0),
m_ok(true)
{
wxCHECK_RET(size <= sizeof(m_data), wxT("buffer too small"));
memcpy(m_data, data, size); // <--- m_data is not large enough, is not allocated or a stray pointer?
}
before calling OpenEntry, so I can not do any test and avoid the crash.
Message from Visual Studio when crash occurs:
Code: Select all
Exception thrown at 0x00007FFE4671172B (vcruntime140d.dll) in RoadRunner.exe: 0xC0000005: Access violation reading location 0x00000201736FCC11.
Windows 10 64-bit
Visual Studio Professional 2015 (all code compiled as 64 bit).
wxWidgets 3.1.0
Attached zip file is not zipped using wxWidgets - coming from un-controlled source
/Torben