madler / zlib

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

check for nullptr at the beginning of the adler32_z function #902

Closed yeggor closed 7 months ago

yeggor commented 7 months ago

In the len == 1 branch, the buf will be dereferenced before checking for a nullptr

madler commented 7 months ago

Thank you for the suggestion. The documentation shows the call as adler32(0L, Z_NULL, 0), so len is not 1. The comment notes the rationale for the placement of the check, so it is all intentional. I am closing this pull request.