madler / zlib

A massively spiffy yet delicately unobtrusive compression library.
http://zlib.net/
Other
5.46k stars 2.41k forks source link

Zlib uncompress returns Z_BUF_ERROR for invalid inputs >= 0x1999999A bytes #985

Closed terrelln closed 3 weeks ago

terrelln commented 3 weeks ago

Issue: The uncompress() function returns Z_BUF_ERROR for invalid inputs that are 0x1999999A bytes or larger. E.g. on the buffer of all zeros. The output buffer size was tried to be 10x, 20x, 40x, 80x, and 160x the input size, all failed with Z_BUF_ERROR.

Expectation: The function returns Z_DATA_ERROR because the docs say that Z_BUF_ERROR is returned if there was not enough room in the output buffer, and Z_DATA_ERROR if the input data was corrupted or incomplete.

terrelln commented 3 weeks ago

Never mind, fixed by 7d54c69413ed2275b9ea25b376627294ffac5ca8

madler commented 3 weeks ago

From ten years ago.

terrelln commented 3 weeks ago

Yup, sorry for the spam! I was, unfortunately, mistaken about which version we were on.

madler commented 3 weeks ago

No worries! I'm just surprised sometimes about old versions out in the wild.