zlib-ng / minizip-ng

Fork of the popular zip manipulation library found in the zlib distribution.
Other
1.24k stars 434 forks source link

fix incorrect dos date conversion #820

Closed Coeur closed 1 week ago

Coeur commented 1 week ago

When dos_date is 1, mz_zip_dosdate_to_raw_tm should return a date in year 1979. But the cast with (uint16_t) is incorrectly converting -1 to 65535, which turns the date to year 7441.

The issue may have originated from 35c6102e21d76019206154de07b8bb8577018825 or earlier (in unzip.c, ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ;)

It was fixed in the legacy minizip about three years ago: https://github.com/madler/zlib/commit/2014a993addbc8f1b9785d97f55fd189792c2f78