]> git.kaiwu.me - njs.git/commit
QuickJS: fix infinite loop on inflate of a stream needing a dictionary
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 12 Jun 2026 01:36:22 +0000 (18:36 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Tue, 16 Jun 2026 23:22:57 +0000 (16:22 -0700)
commita404538a67ee61f7652c4d450d658e6e156081a4
tree7534280387443eddd6c61677978bd662dd17d113
parent8b0a1a87b1b3bdb20cac302a8dda6202b47dd39b
QuickJS: fix infinite loop on inflate of a stream needing a dictionary

The qjs inflate loop treated only rc < 0 as an error.  Z_NEED_DICT is
positive, so a zlib stream with the FDICT flag and no dictionary made
inflate() return Z_NEED_DICT with no progress every iteration, spinning
forever and growing the output chain on attacker-controlled input.

Handle Z_NEED_DICT explicitly, matching the njs zlib module.
external/qjs_zlib_module.c
test/zlib.t.mjs