]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
gnulib/regexec: Resolve unused variable
authorDarren Kenny <darren.kenny@oracle.com>
Wed, 21 Oct 2020 14:41:27 +0000 (14:41 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 2 Mar 2021 14:54:16 +0000 (15:54 +0100)
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>
bootstrap.conf
conf/Makefile.extra-dist
grub-core/lib/gnulib-patches/fix-unused-value.patch [new file with mode: 0644]

index 6d383240e0bd6b028ecf7fd830f1465273b01e98..4c8c37c16a584219694b1b9fe4561ba0ab244ba0 100644 (file)
@@ -79,7 +79,7 @@ cp -a INSTALL INSTALL.grub
 
 bootstrap_post_import_hook () {
   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 \
       < "grub-core/lib/gnulib-patches/$patchname.patch"
   done
index 37dc3aa10f5a49c363eab28d148114a904037335..0d3b74e8ef9f98b74d5bd42cac67edfaf6fe65a5 100644 (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-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/no-abort.patch
 
diff --git a/grub-core/lib/gnulib-patches/fix-unused-value.patch b/grub-core/lib/gnulib-patches/fix-unused-value.patch
new file mode 100644 (file)
index 0000000..ba51f1b
--- /dev/null
@@ -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.  */