gnulib/regexec: Resolve unused variable

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>
This commit is contained in:
Darren Kenny authored and Daniel Kiper committed 2021-03-02 15:54:16 +01:00
1 parent 6aee4bfd69
commit a983d36bd9
3 files changed
+16 -1

No files matched your search

+1 -1
View File
@@ -79,7 +79,7 @@ cp -a INSTALL INSTALL.grub
bootstrap_post_import_hook () { bootstrap_post_import_hook () {
set -e set -e
for patchname in fix-base64 fix-null-deref fix-width no-abort; do for patchname in fix-base64 fix-null-deref fix-unused-value fix-width no-abort; do
patch -d grub-core/lib/gnulib -p2 \ patch -d grub-core/lib/gnulib -p2 \
< "grub-core/lib/gnulib-patches/$patchname.patch" < "grub-core/lib/gnulib-patches/$patchname.patch"
done done
+1
View File
@@ -30,6 +30,7 @@ EXTRA_DIST += grub-core/genemuinitheader.sh
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-base64.patch
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch
@@ -0,0 +1,14 @@
--- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000
+++ b/lib/regexec.c 2020-10-21 14:32:07.961765604 +0000
@@ -828,7 +828,11 @@
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. */