Skip to content

Commit 93a1989

Browse files
authored
regex: fix OOB bug discovered through ./v -g -force-bounds-checking vlib/regex/ (fix by @penguindark) (#24960)
1 parent 6694673 commit 93a1989

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎vlib/regex/regex.v‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ pub fn (mut re RE) reset() {
353353

354354
// reset state list
355355
re.state_list.clear()
356-
re.group_stack.clear()
356+
// restore initial state of the stack
357+
for mut x in re.group_stack {
358+
x = -1
359+
}
357360
}
358361

359362
// reset for search mode fail

0 commit comments

Comments
 (0)