FileFunctions: bail out when wxZipInputStream stalls on a bad entry - #553
Merged
mrjimenez merged 1 commit intoMay 11, 2026
Merged
Conversation
UnpackZipFile() reads each interesting zip entry with
while (!zip.Eof()) {
zip.Read(buffer, sizeof(buffer));
target.Write(buffer, zip.LastRead());
}
When wxZipInputStream encounters an unsupported compression method
(or any other entry-level decompression error), Read() emits one
'Error: unsupported Zip compression method' wxLogError, returns
zero bytes, and leaves the stream in an error state -- but Eof()
keeps returning false. The loop then spins forever, re-emitting
the wx error on every iteration. Reproduced standalone with a
hand-crafted zip whose entry uses compression method 0xff: 50
iterations to reach the test cap, would have run unbounded.
amule-project#376 was a malformed (or just newer-method) eMule-security
ipfilter.zip on 2024-08-04. Affected daemons logged gigabytes of
identical error lines per minute until disk filled or the user
killed the process. Multiple users reported it within a day, then
the upstream feed got fixed and the symptom went away -- but
nothing prevents the next bad zip from doing the same.
Break the inner loop when Read() returns zero bytes. The wx error
still surfaces exactly once (so the operator sees what failed); no
target data was written so target.Length() is 0; UnpackZipFile
returns false; UnpackArchive returns EFT_Error; the IPFilter
reload caller logs its own 'Failed to load ipfilter.dat ...
unknown format encountered.' and abandons the file. Next IPFilter
fetch picks up a clean copy as before.
Verified on Ubuntu 26.04 ARM64, libwx 3.2:
original loop, hand-crafted bad zip: 50+ iterations
fixed loop: 1 iteration, clean exit
Closes amule-project#376
got3nks
added a commit
to got3nks/amule
that referenced
this pull request
Jul 23, 2026
) The it_CH catalog file was removed in amule-project#552, but the surrounding references were left behind: the LINGUAS entry, the po/CMakeLists.txt language label, the redundant [it_CH] .desktop keys (identical to [it]), and the it_CH -> ITALIAN mapping in the Windows NSIS generator. None affect the build (it is glob-driven and it_CH.po is already gone), but they point at a catalog that no longer exists. Remove them so the tree is consistent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #376 ("Error: unsupported Zip compression method"). On 2024-08-04 the eMule-security IPFilter feed published a malformed
ipfilter.zipand every daemon that auto-fetched it spun in an infinite log loop, filling logs with gigabytes ofError: unsupported Zip compression methodper minute until disk filled or the operator killed the process. The upstream feed has since been fixed, but nothing in our code prevents the next bad zip from doing the same.Root cause
UnpackZipFile()insrc/libs/common/FileFunctions.cppreads each interesting entry with:When
wxZipInputStreamencounters an unsupported compression method (or any other entry-level decompression error),Read()emits onewxLogError, returns zero bytes, and parks the stream in an error state — butEof()keeps returning false. The loop then spins forever, re-emitting the wx error on every iteration.Fix
Break the inner loop when
Read()returns zero bytes. The wx error still surfaces exactly once so the operator sees what failed;target.Length()stays 0;UnpackZipFilereturns false;UnpackArchivereturnsEFT_Error; the existingIPFilter::Reloadcaller logsFailed to load ipfilter.dat file '...', unknown format encountered.and abandons the file. Next IPFilter fetch picks up a clean copy as before.Verification
Standalone reproduction on Ubuntu 26.04 ARM64, libwx 3.2 — built a hand-crafted zip with one entry using compression method
0xff:Then compile-tested
FileFunctions.cppclean against the project's exact flags.Closes #376