diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:29:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:29:51 +0000 |
commit | 6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e (patch) | |
tree | 32451fa3cdd9321fb2591fada9891b2cb70a9cd1 /grub-core/lib/gnulib-patches | |
parent | Initial commit. (diff) | |
download | grub2-6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e.tar.xz grub2-6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e.zip |
Adding upstream version 2.06.upstream/2.06upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | grub-core/lib/gnulib-patches/fix-base64.patch | 21 | ||||
-rw-r--r-- | grub-core/lib/gnulib-patches/fix-null-deref.patch | 13 | ||||
-rw-r--r-- | grub-core/lib/gnulib-patches/fix-null-state-deref.patch | 12 | ||||
-rw-r--r-- | grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch | 15 | ||||
-rw-r--r-- | grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch | 12 | ||||
-rw-r--r-- | grub-core/lib/gnulib-patches/fix-uninit-structure.patch | 11 | ||||
-rw-r--r-- | grub-core/lib/gnulib-patches/fix-unused-value.patch | 14 | ||||
-rw-r--r-- | grub-core/lib/gnulib-patches/fix-width.patch | 217 | ||||
-rw-r--r-- | grub-core/lib/gnulib-patches/no-abort.patch | 26 |
9 files changed, 341 insertions, 0 deletions
diff --git a/grub-core/lib/gnulib-patches/fix-base64.patch b/grub-core/lib/gnulib-patches/fix-base64.patch new file mode 100644 index 0000000..985db12 --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-base64.patch @@ -0,0 +1,21 @@ +diff --git a/lib/base64.h b/lib/base64.h +index 9cd0183b8..185a2afa1 100644 +--- a/lib/base64.h ++++ b/lib/base64.h +@@ -21,8 +21,14 @@ + /* Get size_t. */ + # include <stddef.h> + +-/* Get bool. */ +-# include <stdbool.h> ++#ifndef GRUB_POSIX_BOOL_DEFINED ++typedef enum { false = 0, true = 1 } bool; ++#define GRUB_POSIX_BOOL_DEFINED 1 ++#endif ++ ++#ifndef _GL_ATTRIBUTE_CONST ++# define _GL_ATTRIBUTE_CONST /* empty */ ++#endif + + # ifdef __cplusplus + extern "C" { diff --git a/grub-core/lib/gnulib-patches/fix-null-deref.patch b/grub-core/lib/gnulib-patches/fix-null-deref.patch new file mode 100644 index 0000000..8fafa15 --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-null-deref.patch @@ -0,0 +1,13 @@ +diff --git a/lib/argp-parse.c b/lib/argp-parse.c +index 6dec57310..900adad54 100644 +--- a/lib/argp-parse.c ++++ b/lib/argp-parse.c +@@ -940,7 +940,7 @@ weak_alias (__argp_parse, argp_parse) + void * + __argp_input (const struct argp *argp, const struct argp_state *state) + { +- if (state) ++ if (state && state->pstate) + { + struct group *group; + struct parser *parser = state->pstate; diff --git a/grub-core/lib/gnulib-patches/fix-null-state-deref.patch b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch new file mode 100644 index 0000000..813ec09 --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-null-state-deref.patch @@ -0,0 +1,12 @@ +--- a/lib/argp-help.c 2020-10-28 14:32:19.189215988 +0000 ++++ b/lib/argp-help.c 2020-10-28 14:38:21.204673940 +0000 +@@ -145,7 +145,8 @@ + if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin) + { + __argp_failure (state, 0, 0, +- dgettext (state->root_argp->argp_domain, ++ dgettext (state == NULL ? NULL ++ : state->root_argp->argp_domain, + "\ + ARGP_HELP_FMT: %s value is less than or equal to %s"), + "rmargin", up->name); diff --git a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch new file mode 100644 index 0000000..02e0631 --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch @@ -0,0 +1,15 @@ +--- a/lib/regcomp.c 2020-11-24 17:06:08.159223858 +0000 ++++ b/lib/regcomp.c 2020-11-24 17:06:15.630253923 +0000 +@@ -3808,11 +3808,7 @@ + create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, + re_token_type_t type) + { +- re_token_t t; +-#if defined GCC_LINT || defined lint +- memset (&t, 0, sizeof t); +-#endif +- t.type = type; ++ re_token_t t = { .type = type }; + return create_token_tree (dfa, left, right, &t); + } + diff --git a/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch new file mode 100644 index 0000000..db6dac9 --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-regexec-null-deref.patch @@ -0,0 +1,12 @@ +--- a/lib/regexec.c 2020-10-21 14:25:35.310195912 +0000 ++++ b/lib/regexec.c 2020-11-05 10:55:09.621542984 +0000 +@@ -1692,6 +1692,9 @@ + { + Idx top = mctx->state_log_top; + ++ if (mctx->state_log == NULL) ++ return REG_NOERROR; ++ + if ((next_state_log_idx >= mctx->input.bufs_len + && mctx->input.bufs_len < mctx->input.len) + || (next_state_log_idx >= mctx->input.valid_len diff --git a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch new file mode 100644 index 0000000..7b4d9f6 --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch @@ -0,0 +1,11 @@ +--- a/lib/regcomp.c 2020-10-22 13:49:06.770168928 +0000 ++++ b/lib/regcomp.c 2020-10-22 13:50:37.026528298 +0000 +@@ -3662,7 +3662,7 @@ + Idx alloc = 0; + #endif /* not RE_ENABLE_I18N */ + reg_errcode_t ret; +- re_token_t br_token; ++ re_token_t br_token = {0}; + bin_tree_t *tree; + + sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); 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 index 0000000..ba51f1b --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-unused-value.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. */ diff --git a/grub-core/lib/gnulib-patches/fix-width.patch b/grub-core/lib/gnulib-patches/fix-width.patch new file mode 100644 index 0000000..0a208ad --- /dev/null +++ b/grub-core/lib/gnulib-patches/fix-width.patch @@ -0,0 +1,217 @@ +diff --git a/lib/argp-fmtstream.c b/lib/argp-fmtstream.c +index ba6a407f7..d0685b3d4 100644 +--- a/lib/argp-fmtstream.c ++++ b/lib/argp-fmtstream.c +@@ -28,9 +28,11 @@ + #include <errno.h> + #include <stdarg.h> + #include <ctype.h> ++#include <wchar.h> + + #include "argp-fmtstream.h" + #include "argp-namefrob.h" ++#include "mbswidth.h" + + #ifndef ARGP_FMTSTREAM_USE_LINEWRAP + +@@ -115,6 +117,51 @@ weak_alias (__argp_fmtstream_free, argp_fmtstream_free) + #endif + #endif + ++ ++/* Return the pointer to the first character that doesn't fit in l columns. */ ++static inline const ptrdiff_t ++add_width (const char *ptr, const char *end, size_t l) ++{ ++ mbstate_t ps; ++ const char *ptr0 = ptr; ++ ++ memset (&ps, 0, sizeof (ps)); ++ ++ while (ptr < end) ++ { ++ wchar_t wc; ++ size_t s, k; ++ ++ s = mbrtowc (&wc, ptr, end - ptr, &ps); ++ if (s == (size_t) -1) ++ break; ++ if (s == (size_t) -2) ++ { ++ if (1 >= l) ++ break; ++ l--; ++ ptr++; ++ continue; ++ } ++ ++ if (wc == '\e' && ptr + 3 < end ++ && ptr[1] == '[' && (ptr[2] == '0' || ptr[2] == '1') ++ && ptr[3] == 'm') ++ { ++ ptr += 4; ++ continue; ++ } ++ ++ k = wcwidth (wc); ++ ++ if (k >= l) ++ break; ++ l -= k; ++ ptr += s; ++ } ++ return ptr - ptr0; ++} ++ + /* Process FS's buffer so that line wrapping is done from POINT_OFFS to the + end of its buffer. This code is mostly from glibc stdio/linewrap.c. */ + void +@@ -168,13 +215,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + if (!nl) + { + /* The buffer ends in a partial line. */ ++ size_t display_width = mbsnwidth (buf, fs->p - buf, ++ MBSW_STOP_AT_NUL); + +- if (fs->point_col + len < fs->rmargin) ++ if (fs->point_col + display_width < fs->rmargin) + { + /* The remaining buffer text is a partial line and fits + within the maximum line width. Advance point for the + characters to be written and stop scanning. */ +- fs->point_col += len; ++ fs->point_col += display_width; + break; + } + else +@@ -182,14 +231,18 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + the end of the buffer. */ + nl = fs->p; + } +- else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin) +- { +- /* The buffer contains a full line that fits within the maximum +- line width. Reset point and scan the next line. */ +- fs->point_col = 0; +- buf = nl + 1; +- continue; +- } ++ else ++ { ++ size_t display_width = mbsnwidth (buf, nl - buf, MBSW_STOP_AT_NUL); ++ if (display_width < (ssize_t) fs->rmargin) ++ { ++ /* The buffer contains a full line that fits within the maximum ++ line width. Reset point and scan the next line. */ ++ fs->point_col = 0; ++ buf = nl + 1; ++ continue; ++ } ++ } + + /* This line is too long. */ + r = fs->rmargin - 1; +@@ -225,7 +278,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + char *p, *nextline; + int i; + +- p = buf + (r + 1 - fs->point_col); ++ p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); + while (p >= buf && !isblank ((unsigned char) *p)) + --p; + nextline = p + 1; /* This will begin the next line. */ +@@ -243,7 +296,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + { + /* A single word that is greater than the maximum line width. + Oh well. Put it on an overlong line by itself. */ +- p = buf + (r + 1 - fs->point_col); ++ p = buf + add_width (buf, fs->p, (r + 1 - fs->point_col)); + /* Find the end of the long word. */ + if (p < nl) + do +@@ -277,7 +330,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs) + && fs->p > nextline) + { + /* The margin needs more blanks than we removed. */ +- if (fs->end - fs->p > fs->wmargin + 1) ++ if (mbsnwidth (fs->p, fs->end - fs->p, MBSW_STOP_AT_NUL) ++ > fs->wmargin + 1) + /* Make some space for them. */ + { + size_t mv = fs->p - nextline; +diff --git a/lib/argp-help.c b/lib/argp-help.c +index e5375a0f0..5d8f451ec 100644 +--- a/lib/argp-help.c ++++ b/lib/argp-help.c +@@ -51,6 +51,7 @@ + #include "argp.h" + #include "argp-fmtstream.h" + #include "argp-namefrob.h" ++#include "mbswidth.h" + + #ifndef SIZE_MAX + # define SIZE_MAX ((size_t) -1) +@@ -1432,7 +1433,7 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state, + + /* Manually do line wrapping so that it (probably) won't get wrapped at + any embedded spaces. */ +- space (stream, 1 + nl - cp); ++ space (stream, 1 + mbsnwidth (cp, nl - cp, MBSW_STOP_AT_NUL)); + + __argp_fmtstream_write (stream, cp, nl - cp); + } +diff --git a/lib/mbswidth.c b/lib/mbswidth.c +index 408a15e34..b3fb7f83a 100644 +--- a/lib/mbswidth.c ++++ b/lib/mbswidth.c +@@ -38,6 +38,14 @@ + /* Get INT_MAX. */ + #include <limits.h> + ++#ifndef FALLTHROUGH ++# if __GNUC__ < 7 ++# define FALLTHROUGH ((void) 0) ++# else ++# define FALLTHROUGH __attribute__ ((__fallthrough__)) ++# endif ++#endif ++ + /* Returns the number of columns needed to represent the multibyte + character string pointed to by STRING. If a non-printable character + occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. +@@ -90,6 +98,10 @@ mbsnwidth (const char *string, size_t nbytes, int flags) + p++; + width++; + break; ++ case '\0': ++ if (flags & MBSW_STOP_AT_NUL) ++ return width; ++ FALLTHROUGH; + default: + /* If we have a multibyte sequence, scan it up to its end. */ + { +@@ -168,6 +180,9 @@ mbsnwidth (const char *string, size_t nbytes, int flags) + { + unsigned char c = (unsigned char) *p++; + ++ if (c == 0 && (flags & MBSW_STOP_AT_NUL)) ++ return width; ++ + if (isprint (c)) + { + if (width == INT_MAX) +diff --git a/lib/mbswidth.h b/lib/mbswidth.h +index 2b5c53c37..45a123e63 100644 +--- a/lib/mbswidth.h ++++ b/lib/mbswidth.h +@@ -45,6 +45,10 @@ extern "C" { + control characters and 1 otherwise. */ + #define MBSW_REJECT_UNPRINTABLE 2 + ++/* If this bit is set \0 is treated as the end of string. ++ Otherwise it's treated as a normal one column width character. */ ++#define MBSW_STOP_AT_NUL 4 ++ + + /* Returns the number of screen columns needed for STRING. */ + #define mbswidth gnu_mbswidth /* avoid clash with UnixWare 7.1.1 function */ diff --git a/grub-core/lib/gnulib-patches/no-abort.patch b/grub-core/lib/gnulib-patches/no-abort.patch new file mode 100644 index 0000000..e469c47 --- /dev/null +++ b/grub-core/lib/gnulib-patches/no-abort.patch @@ -0,0 +1,26 @@ +diff --git a/lib/regcomp.c b/lib/regcomp.c +index cc85f35ac..de45ebb5c 100644 +--- a/lib/regcomp.c ++++ b/lib/regcomp.c +@@ -528,9 +528,9 @@ regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf, + to this routine. If we are given anything else, or if other regex + code generates an invalid error code, then the program has a bug. + Dump core so we can fix it. */ +- abort (); +- +- msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); ++ msg = gettext ("unknown regexp error"); ++ else ++ msg = gettext (__re_error_msgid + __re_error_msgid_idx[errcode]); + + msg_size = strlen (msg) + 1; /* Includes the null. */ + +@@ -1136,7 +1136,7 @@ optimize_utf8 (re_dfa_t *dfa) + } + break; + default: +- abort (); ++ break; + } + + if (mb_chars || has_period) |