[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/11] gnulib/regexec: Resolve unused variable
From: |
Robbie Harwood |
Subject: |
[PATCH 04/11] gnulib/regexec: Resolve unused variable |
Date: |
Mon, 25 Oct 2021 17:55:37 -0400 |
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 e48fe5333..90330ef39 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -815,7 +815,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 00/11] Code hygiene fixes from grub, Robbie Harwood, 2021/10/25
- [PATCH 08/11] Fix __argp_fmtstream_point()'s return type and comparisons with it, Robbie Harwood, 2021/10/25
- [PATCH 07/11] Make CFLAGS less painful, Robbie Harwood, 2021/10/25
- [PATCH 02/11] argp-parse.c (__argp_input): Don't crash if pstate is NULL, Robbie Harwood, 2021/10/25
- [PATCH 05/11] Fix width computation, Robbie Harwood, 2021/10/25
- [PATCH 01/11] Fix base64 module to work with grub codebase, Robbie Harwood, 2021/10/25
- [PATCH 06/11] Make gnulib's regcomp not abort(), Robbie Harwood, 2021/10/25
- [PATCH 03/11] gnulib/regexec: Fix possible null-dereference, Robbie Harwood, 2021/10/25
- [PATCH 11/11] Fixup for -Werror=ignored-qualifiers issues, Robbie Harwood, 2021/10/25
- [PATCH 04/11] gnulib/regexec: Resolve unused variable,
Robbie Harwood <=
- [PATCH 09/11] Fix up a bunch of "gcc -Werror=sign-compare" complaints, Robbie Harwood, 2021/10/25
- [PATCH 10/11] Paper over a stringop-overflow warning about wide char handling, Robbie Harwood, 2021/10/25