Resolves: #1245712 - prevent infinite recursion in ihungetc()

This commit is contained in:
Kamil Dudka 2015-07-22 17:46:28 +02:00
parent 6f88cea129
commit daebc620a0
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From d1079f66e2fa1b238fa5b8dd038cb34f5ac001d0 Mon Sep 17 00:00:00 2001
From: Peter Stephenson <p.stephenson@samsung.com>
Date: Wed, 22 Jul 2015 14:38:03 +0100
Subject: [PATCH] 35854: prevent infinite recursion in ihungetc()
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
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

View File

@ -3,7 +3,7 @@
Summary: Powerful interactive shell Summary: Powerful interactive shell
Name: zsh Name: zsh
Version: 5.0.8 Version: 5.0.8
Release: 4%{?dist} Release: 5%{?dist}
License: MIT License: MIT
URL: http://zsh.sourceforge.net/ URL: http://zsh.sourceforge.net/
Group: System Environment/Shells Group: System Environment/Shells
@ -27,6 +27,9 @@ Patch3: zsh-5.0.8-comp-bz1238544.patch
# backport completion for dnf (#1239337) # backport completion for dnf (#1239337)
Patch4: zsh-5.0.8-comp-dnf.patch 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: coreutils sed ncurses-devel libcap-devel
BuildRequires: texinfo texi2html gawk hostname BuildRequires: texinfo texi2html gawk hostname
Requires(post): info grep Requires(post): info grep
@ -65,6 +68,7 @@ This package contains the Zsh manual in html format.
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1
cp -p %SOURCE7 . cp -p %SOURCE7 .
@ -182,6 +186,9 @@ fi
%doc Doc/*.html %doc Doc/*.html
%changelog %changelog
* Wed Jul 22 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-5
- prevent infinite recursion in ihungetc() (#1245712)
* Tue Jul 07 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-4 * Tue Jul 07 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-4
- backport completion for dnf (#1239337) - backport completion for dnf (#1239337)