You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
heap-buffer-overflow in lre_exec_backtrack() via deserialized RegExp bytecode with out-of-bounds save index #1375
JS_ReadRegExp() stores regex bytecode verbatim without validating that REOP_save_start/REOP_save_end indices are within capture_count. The only guard is an assert() at libregexp.c:2252-2253, compiled out with NDEBUG. A crafted serialized regex can trigger a heap write far past the capture[] allocation.
==1750466==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x502000001490 at pc 0x55fb5a0cfc26 bp 0x7ffcc4ad81e0 sp 0x7ffcc4ad81d8
WRITE of size 8 at 0x502000001490 thread T0
#0 0x55fb5a0cfc25 in lre_exec_backtrack .../quickjs/libregexp.c:2254:57
#1 0x55fb5a0cbc0d in lre_exec .../quickjs/libregexp.c:2528:11
#2 0x55fb59fca201 in js_regexp_exec .../quickjs/quickjs.c:47442:14
#3 0x55fb59ed15e2 in js_call_c_function .../quickjs/quickjs.c:17113:19
#4 0x55fb59f14868 in JS_CallInternal .../quickjs/quickjs.c:17329:16
#5 0x55fb59f183f1 in JS_CallInternal .../quickjs/quickjs.c:17787:27
#6 0x55fb59feead8 in async_func_resume .../quickjs/quickjs.c:20225:12
#7 0x55fb59feead8 in js_async_function_resume .../quickjs/quickjs.c:20480:16
#8 0x55fb59f56044 in js_async_function_call .../quickjs/quickjs.c:20599:10
...
Thanks for looking into this and we appreciate any feedback!
Activity
Validate save index in lre_exec_backtrack
saghul commentedon Mar 3, 2026
See #1377
Validate save index in lre_exec_backtrack
Validate save index in lre_exec_backtrack
Validate save index in lre_exec_backtrack
Validate save index in lre_exec_backtrack
Validate save index in lre_exec_backtrack
Validate save index in lre_exec_backtrack