Skip to content
Myr

Fix heap-buffer-overflow in raw file loading

Before adoption: this commit came in with the history the project adopted, so no landing records it.

When `jv_string_append_buf` overflows the string length limit, it returns an invalid `jv`; `jv_load_file` then re-entered it on the invalid value and overran the heap. Break out of the loop once the value is invalid. Fixes CVE-2026-49839.

authored by itchyny · committed by itchyny · parent 985abe5 · Browse files · 1 file+2 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−0 removed

  • other:+2 added−0 removed

1 file+2 added−0 removed

modified:src/jv_file.c+2 added
55 unmodified lines
56 }5758 if (raw) {59 data = jv_string_append_buf(data, buf, n);60 if (!jv_is_valid(data))61 break;62 } else {63 jv_parser_set_buf(parser, buf, n, !feof(file));64 jv value;65 while (jv_is_valid((value = jv_parser_next(parser))))
19 unmodified lines