1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-05-13 07:03:33 +00:00

regex: Fix use of uninitialized variable (regression yesterday).

Reported by Coverity.

* lib/regexec.c (re_search_internal): Move initialization of variable
'save_state_log' further up.
This commit is contained in:
Bruno Haible
2026-04-13 17:14:26 +02:00
parent 9774624062
commit c754c51f0f
2 changed files with 9 additions and 2 deletions

View File

@@ -627,6 +627,8 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
/* We must check the longest matching, if nmatch > 0. */
fl_longest_match = (nmatch != 0 || dfa->nbackref);
re_dfastate_t **save_state_log = NULL;
err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1,
preg->translate, (preg->syntax & RE_ICASE) != 0,
dfa);
@@ -678,8 +680,6 @@ re_search_internal (const regex_t *preg, const char *string, Idx length,
| (t != NULL ? 1 : 0))
: 8);
re_dfastate_t **save_state_log = NULL;
for (;; match_first += incr)
{
err = REG_NOMATCH;