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 #73

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 100% whenever csize and usize are identical, which they are in case of a directory. This may also prevent spurious rounding problems. Reproducer: 1) create a zip file from a directory (any) eg mkdir Test; cp /etc/passwd Test; zip -r Test Test 2) list zipfile using unzip-mem -v: unzip-mem -v Test Floating point exception (core dumped)

jmoellers commented 5 years ago

I'll add a test case.