1From 75c3d3cec4f408848f575d6d5e30a95bd6313db0 Mon Sep 17 00:00:00 2001
2From: Darren Kenny <darren.kenny@oracle.com>
3Date: Thu, 22 Oct 2020 13:54:06 +0000
4Subject: [PATCH] gnulib/regcomp: Fix uninitialized token structure
5
6The code is assuming that the value of br_token.constraint was
7initialized to zero when it wasn't.
8
9While some compilers will ensure that, not all do, so it is better to
10fix this explicitly than leave it to chance.
11
12Fixes: CID 73749
13
14Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
15Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
16[Add changes to generated files]
17Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
18---
19 Makefile.in                                             |  1 +
20 conf/Makefile.extra-dist                                |  1 +
21 grub-core/lib/gnulib-patches/fix-uninit-structure.patch | 11 +++++++++++
22 grub-core/lib/gnulib/regcomp.c                          |  2 +-
23 4 files changed, 14 insertions(+), 1 deletion(-)
24 create mode 100644 grub-core/lib/gnulib-patches/fix-uninit-structure.patch
25
26diff --git a/Makefile.in b/Makefile.in
27index e6b287b..d58a7d7 100644
28--- a/Makefile.in
29+++ b/Makefile.in
30@@ -2742,6 +2742,7 @@ EXTRA_DIST = autogen.sh geninit.sh gentpl.py Makefile.util.def \
31 	grub-core/gensyminfo.sh.in grub-core/gensymlist.sh \
32 	grub-core/genemuinit.sh grub-core/genemuinitheader.sh \
33 	grub-core/lib/gnulib-patches/fix-null-deref.patch \
34+	grub-core/lib/gnulib-patches/fix-uninit-structure.patch \
35 	grub-core/lib/gnulib-patches/fix-unused-value.patch \
36 	grub-core/lib/gnulib-patches/fix-width.patch \
37 	grub-core/lib/gnulib-patches/no-abort.patch \
38diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
39index 9b01152..9e55458 100644
40--- a/conf/Makefile.extra-dist
41+++ b/conf/Makefile.extra-dist
42@@ -29,6 +29,7 @@ EXTRA_DIST += grub-core/genemuinit.sh
43 EXTRA_DIST += grub-core/genemuinitheader.sh
44
45 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-null-deref.patch
46+EXTRA_DIST += grub-core/lib/gnulib-patches/fix-uninit-structure.patch
47 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-unused-value.patch
48 EXTRA_DIST += grub-core/lib/gnulib-patches/fix-width.patch
49 EXTRA_DIST += grub-core/lib/gnulib-patches/no-abort.patch
50diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch
51new file mode 100644
52index 0000000..7b4d9f6
53--- /dev/null
54+++ b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch
55@@ -0,0 +1,11 @@
56+--- a/lib/regcomp.c	2020-10-22 13:49:06.770168928 +0000
57++++ b/lib/regcomp.c	2020-10-22 13:50:37.026528298 +0000
58+@@ -3662,7 +3662,7 @@
59+   Idx alloc = 0;
60+ #endif /* not RE_ENABLE_I18N */
61+   reg_errcode_t ret;
62+-  re_token_t br_token;
63++  re_token_t br_token = {0};
64+   bin_tree_t *tree;
65+
66+   sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
67diff --git a/grub-core/lib/gnulib/regcomp.c b/grub-core/lib/gnulib/regcomp.c
68index fe7dfcb..2545d3e 100644
69--- a/grub-core/lib/gnulib/regcomp.c
70+++ b/grub-core/lib/gnulib/regcomp.c
71@@ -3662,7 +3662,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
72   Idx alloc = 0;
73 #endif /* not RE_ENABLE_I18N */
74   reg_errcode_t ret;
75-  re_token_t br_token;
76+  re_token_t br_token = {0};
77   bin_tree_t *tree;
78
79   sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
80--
812.14.2
82
83