diff -Nru bash-5.2/debian/changelog bash-5.2/debian/changelog --- bash-5.2/debian/changelog 2022-09-29 03:52:11.000000000 -0400 +++ bash-5.2/debian/changelog 2022-10-07 17:03:05.000000000 -0400 @@ -1,3 +1,11 @@ +bash (5.2-1ubuntu2) kinetic; urgency=medium + + * debian/patches: Import two upstream patches to fix crashes: + - Bash-5.2-patch-1-fix-crash-with-unset-arrays-in-arit.diff + - Bash-5.2-patch-2-fix-crash-in-readline-when-started-.diff (LP:#1992206) + + -- Nick Rosbrook Fri, 07 Oct 2022 17:03:05 -0400 + bash (5.2-1ubuntu1) kinetic; urgency=medium * Merge with Debian; remaining changes: diff -Nru bash-5.2/debian/patches/Bash-5.2-patch-1-fix-crash-with-unset-arrays-in-arit.diff bash-5.2/debian/patches/Bash-5.2-patch-1-fix-crash-with-unset-arrays-in-arit.diff --- bash-5.2/debian/patches/Bash-5.2-patch-1-fix-crash-with-unset-arrays-in-arit.diff 1969-12-31 19:00:00.000000000 -0500 +++ bash-5.2/debian/patches/Bash-5.2-patch-1-fix-crash-with-unset-arrays-in-arit.diff 2022-10-07 17:00:33.000000000 -0400 @@ -0,0 +1,44 @@ +Description: fix crash with unset arrays in arithmetic contexts +Author: Chet Ramey +Origin: upstream, http://git.savannah.gnu.org/cgit/bash.git/commit/?id=a1e58b8c064cbf3cb0180b63e581770de7ccea5b +Last-Update: 2022-10-07 +--- +From a1e58b8c064cbf3cb0180b63e581770de7ccea5b Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Wed, 5 Oct 2022 10:36:55 -0400 +Subject: [PATCH 1/2] Bash-5.2 patch 1: fix crash with unset arrays in + arithmetic contexts + +--- + patchlevel.h | 2 +- + subst.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/patchlevel.h b/patchlevel.h +index 165390c1..c0dbb500 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 0 ++#define PATCHLEVEL 1 + + #endif /* _PATCHLEVEL_H_ */ +diff --git a/subst.c b/subst.c +index d9feabca..93b91606 100644 +--- a/subst.c ++++ b/subst.c +@@ -10857,7 +10857,7 @@ expand_array_subscript (string, sindex, quoted, flags) + exp = substring (string, si+1, ni); + t = expand_subscript_string (exp, quoted & ~(Q_ARITH|Q_DOUBLE_QUOTES)); + free (exp); +- exp = sh_backslash_quote (t, abstab, 0); ++ exp = t ? sh_backslash_quote (t, abstab, 0) : savestring (""); + free (t); + + slen = STRLEN (exp); +-- +2.37.2 + diff -Nru bash-5.2/debian/patches/Bash-5.2-patch-2-fix-crash-in-readline-when-started-.diff bash-5.2/debian/patches/Bash-5.2-patch-2-fix-crash-in-readline-when-started-.diff --- bash-5.2/debian/patches/Bash-5.2-patch-2-fix-crash-in-readline-when-started-.diff 1969-12-31 19:00:00.000000000 -0500 +++ bash-5.2/debian/patches/Bash-5.2-patch-2-fix-crash-in-readline-when-started-.diff 2022-10-07 17:02:33.000000000 -0400 @@ -0,0 +1,48 @@ +Description: fix crash in readline when started with an invalid locale specification +Author: Chet Ramey +Origin: upstream, http://git.savannah.gnu.org/cgit/bash.git/commit/?id=a99d905216cc0aac5de0c3050f4afc54e21c6bc5 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1992206 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021109 +Last-Update: 2022-10-07 +--- +From a99d905216cc0aac5de0c3050f4afc54e21c6bc5 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Wed, 5 Oct 2022 10:37:38 -0400 +Subject: [PATCH 2/2] Bash-5.2 patch 2: fix crash in readline when started with + an invalid locale specification + +--- + lib/readline/nls.c | 4 ++++ + patchlevel.h | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/lib/readline/nls.c b/lib/readline/nls.c +index 5c6a13b6..8c027d6b 100644 +--- a/lib/readline/nls.c ++++ b/lib/readline/nls.c +@@ -141,6 +141,10 @@ _rl_init_locale (void) + if (lspec == 0) + lspec = ""; + ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */ ++ if (ret == 0 || *ret == 0) ++ ret = setlocale (LC_CTYPE, (char *)NULL); ++ if (ret == 0 || *ret == 0) ++ ret = RL_DEFAULT_LOCALE; + #else + ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec; + #endif +diff --git a/patchlevel.h b/patchlevel.h +index c0dbb500..d465c244 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -25,6 +25,6 @@ + regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh + looks for to find the patch level (for the sccs version string). */ + +-#define PATCHLEVEL 1 ++#define PATCHLEVEL 2 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.37.2 + diff -Nru bash-5.2/debian/patches/series bash-5.2/debian/patches/series --- bash-5.2/debian/patches/series 2022-09-29 03:52:11.000000000 -0400 +++ bash-5.2/debian/patches/series 2022-10-07 17:03:05.000000000 -0400 @@ -17,3 +17,5 @@ use-system-texi2html.diff man-macro-warnings.diff man-vx-opts.diff +Bash-5.2-patch-1-fix-crash-with-unset-arrays-in-arit.diff +Bash-5.2-patch-2-fix-crash-in-readline-when-started-.diff