Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to decompress some MMCMP files #20

Closed
manxorist opened this issue May 22, 2021 · 2 comments
Closed

fails to decompress some MMCMP files #20

manxorist opened this issue May 22, 2021 · 2 comments

Comments

@manxorist
Copy link
Contributor

https://manx.datengang.de/openmpt/temp/mmcmp.zip contains 3 files, only mmcmp-ELECTR~1.MOD is decompressed successfully by ancient.

They have been compressed with MMCMP 1.34 (available here: http://cd.textfiles.com/scene96-2/programs/mmcmp134/).

manx@quadratus:~/projects/ancient/ancient.git$ ./ancient decompress /home/manx/c-home/stuff/mmcmp/compressed/BENJAM.IT /home/manx/c-home/stuff/mmcmp/ancient/BENJAM.IT
Decompression failed for /home/manx/c-home/stuff/mmcmp/compressed/BENJAM.IT
manx@quadratus:~/projects/ancient/ancient.git$ ./ancient decompress /home/manx/c-home/stuff/mmcmp/compressed/MELTED.XM /home/manx/c-home/stuff/mmcmp/ancient/MELTED.XM
Verify (raw) failed for /home/manx/c-home/stuff/mmcmp/compressed/MELTED.XM
manx@quadratus:~/projects/ancient/ancient.git$ ./ancient decompress /home/manx/c-home/stuff/mmcmp/compressed/mmcmp-ELECTR~1.MOD /home/manx/c-home/stuff/mmcmp/ancient/mmcmp-ELECTR~1.MOD
manx@quadratus:~/projects/ancient/ancient.git$

OpenMPT/libopenmpt can decompress them successfully and match mmuncmp output exactly.

Our current implementation (BSD-3-Clause licensed, so only as reference): https://github.com/OpenMPT/openmpt/blob/master/soundlib/ContainerMMCMP.cpp.

I am no expert on actual compression formats, so I have not looked in any further detail.

@temisu
Copy link
Owner

temisu commented May 22, 2021

These were amazing test files, thank you for that. I'll add them to my test suite.

First problem was due to flag processing which I tried to "fix and improve" compared from MMCMP. I was obviously trying to be too clever (MELTED.XM)

The second file (BENJAM.IT) was really interesting: It has buffer overflow in it. The library rightfully threw an exception on attempted illegal access. However, I modified the code that instead of failing it will cut the output short. This fixed the issue. (Obviously any decompressor that does not handle this case gracefully has security issues...)

@temisu temisu closed this as completed May 22, 2021
@manxorist
Copy link
Contributor Author

Thanks for the very fast fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants