nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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