]> Savannah Git Hosting - gnulib.git/commit
regex: fix free_fail_stack undefined behavior
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 11 Mar 2022 21:27:33 +0000 (13:27 -0800)
committerBruno Haible <bruno@clisp.org>
Wed, 31 Aug 2022 22:53:11 +0000 (00:53 +0200)
commit46178509bcf37226eac7ff2d943dc34b8568a7b1
tree6888e0c743c3241d2c30f7b13fa7ded9816b3e96
parent20ed97afc3fc8e4aee6f8e87c5b6e39b09baf3c0
regex: fix free_fail_stack undefined behavior

* lib/regexec.c (push_fail_stack): Don’t increment number of
re_fail_stack_t entries until after successful allocation.  This
prevents a crash if re_realloc or re_malloc fails here, and a
later free_fail_stack examines regs or a later pop_fail_stack
examines node.  Problem discovered by Coverity scan sent
2022-03-11 11:03:52Z.
ChangeLog
lib/regexec.c