1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-09-01 02:34:55 +00:00

regex: fix minor over-allocation

* lib/regexec.c (push_fail_stack): Fix off-by-one error that
over-allocated the stack.
This commit is contained in:
Paul Eggert
2022-03-11 13:34:07 -08:00
committed by Bruno Haible
parent 46178509bc
commit d85d2084d4
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -1,5 +1,9 @@
2022-03-11 Paul Eggert <eggert@cs.ucla.edu>
regex: fix minor over-allocation
* lib/regexec.c (push_fail_stack): Fix off-by-one error that
over-allocated the stack.
regex: fix free_fail_stack undefined behavior
* lib/regexec.c (push_fail_stack): Dont increment number of
re_fail_stack_t entries until after successful allocation. This
+1 -1
View File
@@ -1309,7 +1309,7 @@ push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node,
{
reg_errcode_t err;
Idx num = fs->num;
if (num + 1 == fs->alloc)
if (num == fs->alloc)
{
struct re_fail_stack_ent_t *new_array;
new_array = re_realloc (fs->stack, struct re_fail_stack_ent_t,