[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/10] gnulib/regexec: Resolve unused variable
From: |
Robbie Harwood |
Subject: |
[PATCH v2 03/10] gnulib/regexec: Resolve unused variable |
Date: |
Wed, 1 Dec 2021 16:01:58 -0500 |
From: Darren Kenny <darren.kenny@oracle.com>
This is a really minor issue where a variable is being assigned to but
not checked before it is overwritten again.
The reason for this issue is that we are not building with DEBUG set and
this in turn means that the assert() that reads the value of the
variable match_last is being processed out.
The solution, move the assignment to match_last in to an ifdef DEBUG too.
Fixes: CID 292459
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
lib/regexec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/regexec.c b/lib/regexec.c
index d63b8800c..1aad68175 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -807,7 +807,11 @@ re_search_internal (const regex_t *preg, const char
*string, Idx length,
break;
if (__glibc_unlikely (err != REG_NOMATCH))
goto free_return;
+#ifdef DEBUG
+ /* Only used for assertion below when DEBUG is set, otherwise
+ it will be over-written when we loop around. */
match_last = -1;
+#endif
}
else
break; /* We found a match. */
--
2.33.0
[PATCH v2 04/10] Fix width computation, Robbie Harwood, 2021/12/01
[PATCH v2 03/10] gnulib/regexec: Resolve unused variable,
Robbie Harwood <=
[PATCH v2 02/10] gnulib/regexec: Fix possible null-dereference, Robbie Harwood, 2021/12/01
[PATCH v2 05/10] Make gnulib's regcomp not abort(), Robbie Harwood, 2021/12/01