Fix heap buffer overflow in `jvp_string_append` and `jvp_string_copy_replace_bad`
In `jvp_string_append`, the allocation size `(currlen + len) * 2` could overflow `uint32_t` when `currlen + len` exceeds `INT_MAX`, causing a small allocation followed by a large `memcpy`. In `jvp_string_copy_replace_bad`, the output buffer size calculation `length * 3 + 1` could overflow `uint32_t`, again resulting in a small allocation followed by a large write. Add overflow checks to both functions to return an error for strings that would exceed `INT_MAX` in length. Fixes CVE-2026-32316.
I
itchyny committed
e47e56d226519635768e6aab2f38f0ab037c09e5
Parent: 9f778b4