From daebc620a09c4d219c2891d441552e0e26d09a7a Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 22 Jul 2015 17:46:28 +0200 Subject: [PATCH] Resolves: #1245712 - prevent infinite recursion in ihungetc() --- zsh-5.0.8-hist-bz1245712.patch | 41 ++++++++++++++++++++++++++++++++++ zsh.spec | 9 +++++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 zsh-5.0.8-hist-bz1245712.patch diff --git a/zsh-5.0.8-hist-bz1245712.patch b/zsh-5.0.8-hist-bz1245712.patch new file mode 100644 index 0000000..d0572bf --- /dev/null +++ b/zsh-5.0.8-hist-bz1245712.patch @@ -0,0 +1,41 @@ +From d1079f66e2fa1b238fa5b8dd038cb34f5ac001d0 Mon Sep 17 00:00:00 2001 +From: Peter Stephenson +Date: Wed, 22 Jul 2015 14:38:03 +0100 +Subject: [PATCH] 35854: prevent infinite recursion in ihungetc() + +Signed-off-by: Kamil Dudka +--- + Src/hist.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/Src/hist.c b/Src/hist.c +index 6725313..cf224cb 100644 +--- a/Src/hist.c ++++ b/Src/hist.c +@@ -136,6 +136,7 @@ mod_export int hist_skip_flags; + #define HA_NOINC (1<<1) /* Don't store, curhist not incremented */ + #define HA_INWORD (1<<2) /* We're inside a word, don't add + start and end markers */ ++#define HA_UNGET (1<<3) /* Recursively ungetting */ + + /* Array of word beginnings and endings in current history line. */ + +@@ -904,8 +905,13 @@ ihungetc(int c) + + while (!lexstop && !errflag) { + if (hptr[-1] != (char) c && stophist < 4 && +- hptr > chline + 1 && hptr[-1] == '\n' && hptr[-2] == '\\') +- hungetc('\n'), hungetc('\\'); ++ hptr > chline + 1 && hptr[-1] == '\n' && hptr[-2] == '\\' && ++ !(histactive & HA_UNGET)) { ++ histactive |= HA_UNGET; ++ hungetc('\n'); ++ hungetc('\\'); ++ histactive &= ~HA_UNGET; ++ } + + if (expanding) { + zlemetacs--; +-- +2.4.6 + diff --git a/zsh.spec b/zsh.spec index a7b1e43..b1b8c4b 100644 --- a/zsh.spec +++ b/zsh.spec @@ -3,7 +3,7 @@ Summary: Powerful interactive shell Name: zsh Version: 5.0.8 -Release: 4%{?dist} +Release: 5%{?dist} License: MIT URL: http://zsh.sourceforge.net/ Group: System Environment/Shells @@ -27,6 +27,9 @@ Patch3: zsh-5.0.8-comp-bz1238544.patch # backport completion for dnf (#1239337) Patch4: zsh-5.0.8-comp-dnf.patch +# prevent infinite recursion in ihungetc() (#1245712) +Patch5: zsh-5.0.8-hist-bz1245712.patch + BuildRequires: coreutils sed ncurses-devel libcap-devel BuildRequires: texinfo texi2html gawk hostname Requires(post): info grep @@ -65,6 +68,7 @@ This package contains the Zsh manual in html format. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 cp -p %SOURCE7 . @@ -182,6 +186,9 @@ fi %doc Doc/*.html %changelog +* Wed Jul 22 2015 Kamil Dudka - 5.0.8-5 +- prevent infinite recursion in ihungetc() (#1245712) + * Tue Jul 07 2015 Kamil Dudka - 5.0.8-4 - backport completion for dnf (#1239337)