gdraheim / zziplib

The ZZIPlib provides read access on ZIP-archives and unpacked data. It features an additional simplified API following the standard Posix API for file access
Other
62 stars 50 forks source link

Prevent division by zero #74

Closed jmoellers closed 5 years ago

jmoellers commented 5 years ago

When verbously listing a ZIP file with directories, a "Floating point exception" occurs because the uncompressed size "usize" is 0. The fix is to print 0% when usize is 0. Reproducer: mkdir d; for i in $(seq 1 10); do echo This is line $i; done > d/file.txt zip -9r ZIPfile.zip d unzip-mem -v ZIPfile.zip Floating point exception

jmoellers commented 5 years ago

@gdraheim I have kept the local update until this PR is accepted in case you have some modifications. I'm now pestered by maintenance because the bug blocks some maintenance update. Can you please comment upon this PR?

gdraheim commented 5 years ago

I am sorry - I have little time to do the bunch of merges around. I wanted to get to it as soon as possble.

I have merged the patch - may be I am going to look into it later again.

jmoellers commented 5 years ago

Thanks! I know the feeling.