schnaader/precomp-cpp

Preflate related crash

schnaader opened this issue · 4 comments

The file "gam.tar.001.019.001" (15.2 MB, download from Google Drive) crashes precomp.

This seems to be related to the latest preflate changes, as it didn't crash the experimental preflate 0.3.2 version. Additionally, the file position where it happens isn't always the same, so it could be some bug in the thread pool.

Unfortunately, the crash doesn't happen for me when debugging in Visual Studio.

It's easy enough to trigger in VS: release build with debug info. The pointer to the virtual method table for one of the decoder objects is junked. So it is not a "harmless out-of-bounds" read like #88.
If I disable multithreading in preflate decoder, it doesn't crash. I guess I know how I will spend this weekend. ;)

I've pinpointed the problem: it's a resource cleanup issue for large invalid deflate streams. Basically some decoder threads are in flight, when the invalidity of the stream is detected, but the decoder does not wait for the threads to finish before returning.

I've updated preflate to v0.3.5 which should solve this issue.

Works for me, thanks for the quick fix!