]> git.kaiwu.me - njs.git/commit
Buffer: check QJS allocation sizes before narrowing
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 24 Sep 2026 22:48:09 +0000 (15:48 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 25 Sep 2026 23:00:29 +0000 (16:00 -0700)
commit22124b2f305ee152a79471e480a4cba5a7777a93
tree8e07f73f31d128cc034b2626c3e8f06747467b86
parentc3789e2a79379621c06d4af300c9296b2378cd4c
Buffer: check QJS allocation sizes before narrowing

Take a 64-bit size in qjs_buffer_alloc() and reject sizes above
QJS_BUFFER_MAX_LENGTH before converting them.  Previously, a caller
holding a wider size had to narrow it to size_t first, which truncated
it silently on 32-bit platforms.
src/qjs.h
src/qjs_buffer.c