dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0394-gnulib-regcomp-Fix-uninitialized-token-structure.patch

468bd4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
468bd4
From: Darren Kenny <darren.kenny@oracle.com>
468bd4
Date: Thu, 22 Oct 2020 13:54:06 +0000
468bd4
Subject: [PATCH] gnulib/regcomp: Fix uninitialized token structure
468bd4
468bd4
The code is assuming that the value of br_token.constraint was
468bd4
initialized to zero when it wasn't.
468bd4
468bd4
While some compilers will ensure that, not all do, so it is better to
468bd4
fix this explicitly than leave it to chance.
468bd4
468bd4
Fixes: CID 73749
468bd4
468bd4
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
468bd4
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
468bd4
---
468bd4
 grub-core/gnulib/regcomp.c                  |  2 +-
468bd4
 conf/Makefile.extra-dist                    |  1 +
468bd4
 grub-core/gnulib-fix-uninit-structure.patch | 11 +++++++++++
468bd4
 3 files changed, 13 insertions(+), 1 deletion(-)
468bd4
 create mode 100644 grub-core/gnulib-fix-uninit-structure.patch
468bd4
468bd4
diff --git a/grub-core/gnulib/regcomp.c b/grub-core/gnulib/regcomp.c
468bd4
index 596e0cf3ef7..de9f622088f 100644
468bd4
--- a/grub-core/gnulib/regcomp.c
468bd4
+++ b/grub-core/gnulib/regcomp.c
468bd4
@@ -3641,7 +3641,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
468bd4
   Idx alloc = 0;
468bd4
 #endif /* not RE_ENABLE_I18N */
468bd4
   reg_errcode_t ret;
468bd4
-  re_token_t br_token;
468bd4
+  re_token_t br_token = {0};
468bd4
   bin_tree_t *tree;
468bd4
 
468bd4
   sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
468bd4
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
468bd4
index b53fe6dfdcc..883baba56d5 100644
468bd4
--- a/conf/Makefile.extra-dist
468bd4
+++ b/conf/Makefile.extra-dist
468bd4
@@ -31,6 +31,7 @@ EXTRA_DIST += grub-core/genemuinit.sh
468bd4
 EXTRA_DIST += grub-core/genemuinitheader.sh
468bd4
 
468bd4
 EXTRA_DIST += grub-core/gnulib-fix-null-deref.diff
468bd4
+EXTRA_DIST += grub-core/gnulib-fix-uninit-structure.patch
468bd4
 EXTRA_DIST += grub-core/gnulib-fix-unused-value.patch
468bd4
 EXTRA_DIST += grub-core/gnulib-fix-width.diff
468bd4
 EXTRA_DIST += grub-core/gnulib-no-abort.diff
468bd4
diff --git a/grub-core/gnulib-fix-uninit-structure.patch b/grub-core/gnulib-fix-uninit-structure.patch
468bd4
new file mode 100644
468bd4
index 00000000000..7b4d9f67af4
468bd4
--- /dev/null
468bd4
+++ b/grub-core/gnulib-fix-uninit-structure.patch
468bd4
@@ -0,0 +1,11 @@
468bd4
+--- a/lib/regcomp.c	2020-10-22 13:49:06.770168928 +0000
468bd4
++++ b/lib/regcomp.c	2020-10-22 13:50:37.026528298 +0000
468bd4
+@@ -3662,7 +3662,7 @@
468bd4
+   Idx alloc = 0;
468bd4
+ #endif /* not RE_ENABLE_I18N */
468bd4
+   reg_errcode_t ret;
468bd4
+-  re_token_t br_token;
468bd4
++  re_token_t br_token = {0};
468bd4
+   bin_tree_t *tree;
468bd4
+ 
468bd4
+   sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);