From 44214321eec6a906288820cc8e2b1be4b588df23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Wed, 17 Jan 2024 14:05:37 +0100 Subject: [PATCH] fix segfault in delerefilelist Resolves: rhbz#2245462 --- ...-c99.patch => 0007-zsh-configure-c99.patch | 0 0008-zsh-deletefilelist-segfault.patch | 42 +++++++++++++++++++ zsh.spec | 10 ++++- 3 files changed, 50 insertions(+), 2 deletions(-) rename zsh-configure-c99.patch => 0007-zsh-configure-c99.patch (100%) create mode 100644 0008-zsh-deletefilelist-segfault.patch diff --git a/zsh-configure-c99.patch b/0007-zsh-configure-c99.patch similarity index 100% rename from zsh-configure-c99.patch rename to 0007-zsh-configure-c99.patch diff --git a/0008-zsh-deletefilelist-segfault.patch b/0008-zsh-deletefilelist-segfault.patch new file mode 100644 index 0000000..8abaab1 --- /dev/null +++ b/0008-zsh-deletefilelist-segfault.patch @@ -0,0 +1,42 @@ +From d3edf318306e37d2d96c4e4ea442d10207722e94 Mon Sep 17 00:00:00 2001 +From: Bart Schaefer +Date: Sun, 12 Feb 2023 09:52:39 -0800 +Subject: [PATCH] 51404: Nullify filelist after deleting (fix segfault) + +Cherry-picked-by: Lukáš Zaoral +Upstream-commit: d3edf318306e37d2d96c4e4ea442d10207722e94 +--- + Src/jobs.c | 8 ++++++-- + 1 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/Src/jobs.c b/Src/jobs.c +index 4863962b9..59ddd952e 100644 +--- a/Src/jobs.c ++++ b/Src/jobs.c +@@ -1372,8 +1372,10 @@ cleanfilelists(void) + + DPUTS(shell_exiting >= 0, "BUG: cleanfilelists() before exit"); + +- for (i = 1; i <= maxjob; i++) ++ for (i = 1; i <= maxjob; i++) { + deletefilelist(jobtab[i].filelist, 0); ++ jobtab[i].filelist = 0; ++ } + } + + /**/ +@@ -1531,8 +1533,10 @@ havefiles(void) + int i; + + for (i = 1; i <= maxjob; i++) +- if (jobtab[i].stat && jobtab[i].filelist) ++ if (jobtab[i].stat && jobtab[i].filelist && ++ peekfirst(jobtab[i].filelist)) { + return 1; ++ } + return 0; + + } +-- +2.43.0 + diff --git a/zsh.spec b/zsh.spec index 87d0a7f..56074a0 100644 --- a/zsh.spec +++ b/zsh.spec @@ -1,7 +1,7 @@ Summary: Powerful interactive shell Name: zsh Version: 5.9 -Release: 11%{?dist} +Release: 12%{?dist} License: MIT-Modern-Variant AND ISC AND GPL-2.0-only URL: http://zsh.sourceforge.net/ Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz @@ -25,7 +25,10 @@ Patch4: 0004-zsh-enable-PCRE-locale-switching.patch Patch5: 0005-zsh-port-to-pcre2.patch # upstream commit ecd3f9c9506c7720dc6c0833dc5d5eb00e4459c4 Patch6: 0006-zsh-support-texinfo-7.0.patch -Patch7: zsh-configure-c99.patch +# upstream commit 4c89849c98172c951a9def3690e8647dae76308f +Patch7: 0007-zsh-configure-c99.patch +# upstream commit d3edf318306e37d2d96c4e4ea442d10207722e94 +Patch8: 0008-zsh-deletefilelist-segfault.patch BuildRequires: autoconf BuildRequires: coreutils @@ -171,6 +174,9 @@ fi %doc Doc/*.html %changelog +* Wed Jan 17 2024 Lukáš Zaoral - 5.9-12 +- fix segfault in delerefilelist (rhbz#2245462) + * Fri Dec 8 2023 Florian Weimer - 5.9-11 - Fix C compatibility issue in the configure script