From 7467db05d00f7cd5bd5abd466a00091fe1eb18b7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 21 Jan 2020 16:40:08 -0500 Subject: [PATCH] import tcsh-6.20.00-12.el8 --- ...tion-while-loading-corrupted-history.patch | 48 +++++++++++++++++++ ...00-011-fix-infinite-loop-after-ctrlC.patch | 47 ++++++++++++++++++ SPECS/tcsh.spec | 13 ++++- 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 SOURCES/tcsh-6.20.00-010-fix-memory-consumption-while-loading-corrupted-history.patch create mode 100644 SOURCES/tcsh-6.20.00-011-fix-infinite-loop-after-ctrlC.patch diff --git a/SOURCES/tcsh-6.20.00-010-fix-memory-consumption-while-loading-corrupted-history.patch b/SOURCES/tcsh-6.20.00-010-fix-memory-consumption-while-loading-corrupted-history.patch new file mode 100644 index 0000000..8761898 --- /dev/null +++ b/SOURCES/tcsh-6.20.00-010-fix-memory-consumption-while-loading-corrupted-history.patch @@ -0,0 +1,48 @@ +From 1ef6e9d0eef9278829f863fff55755b7a5415b81 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Fri, 11 Jan 2019 10:49:54 -0500 +Subject: [PATCH] Abort history loading on long lines + +diff --git a/sh.lex.c b/sh.lex.c +index fee790a..e945795 100644 +--- a/sh.lex.c ++++ b/sh.lex.c +@@ -145,6 +145,7 @@ lex(struct wordent *hp) + struct wordent *wdp; + eChar c; + int parsehtime = enterhist; ++ int toolong = 0; + + histvalid = 0; + histline.len = 0; +@@ -179,6 +180,8 @@ lex(struct wordent *hp) + wdp = new; + wdp->word = word(parsehtime); + parsehtime = 0; ++ if (enterhist && toolong++ > 10 * 1024) ++ stderror(ERR_LTOOLONG); + } while (wdp->word[0] != '\n'); + cleanup_ignore(hp); + cleanup_until(hp); +@@ -291,9 +294,12 @@ word(int parsehtime) + Char hbuf[12]; + int h; + int dolflg; ++ int toolong = 0; + + cleanup_push(&wbuf, Strbuf_cleanup); + loop: ++ if (enterhist && toolong++ > 256 * 1024) ++ seterror(ERR_WTOOLONG); + while ((c = getC(DOALL)) == ' ' || c == '\t') + continue; + if (cmap(c, _META | _ESC)) +@@ -352,6 +358,8 @@ word(int parsehtime) + c1 = 0; + dolflg = DOALL; + for (;;) { ++ if (enterhist && toolong++ > 256 * 1024) ++ seterror(ERR_WTOOLONG); + if (c1) { + if (c == c1) { + c1 = 0; diff --git a/SOURCES/tcsh-6.20.00-011-fix-infinite-loop-after-ctrlC.patch b/SOURCES/tcsh-6.20.00-011-fix-infinite-loop-after-ctrlC.patch new file mode 100644 index 0000000..9e49a82 --- /dev/null +++ b/SOURCES/tcsh-6.20.00-011-fix-infinite-loop-after-ctrlC.patch @@ -0,0 +1,47 @@ +From 83c5be028419b3f27c3cc707b88fb21bfa4e1b11 Mon Sep 17 00:00:00 2001 +From: zoulasc +Date: Sat, 19 Oct 2019 08:52:53 -0400 +Subject: [PATCH] FIx PR/113: failing -c command causes infinite loop + +diff --git a/sh.c b/sh.c +index 4b5c624..dd87172 100644 +--- a/sh.c ++++ b/sh.c +@@ -237,6 +237,7 @@ main(int argc, char **argv) + int nofile = 0; + volatile int nverbose = 0; + volatile int rdirs = 0; ++ volatile int exitcode = 0; + int quitit = 0; + Char *cp; + #ifdef AUTOLOGOUT +@@ -1390,6 +1391,12 @@ main(int argc, char **argv) + + + if (targinp) { ++ /* If this -c command caused an error before, skip processing */ ++ if (reenter && arginp) { ++ exitcode = 1; ++ goto done; ++ } ++ + arginp = SAVE(targinp); + /* + * we put the command into a variable +@@ -1422,6 +1429,7 @@ main(int argc, char **argv) + */ + process(setintr); + ++done: + /* + * Mop-up. + */ +@@ -1443,7 +1451,7 @@ main(int argc, char **argv) + } + record(); + exitstat(); +- return (0); ++ return exitcode; + } + + void diff --git a/SPECS/tcsh.spec b/SPECS/tcsh.spec index 2afa0d8..fd70d9f 100644 --- a/SPECS/tcsh.spec +++ b/SPECS/tcsh.spec @@ -13,7 +13,7 @@ Name: tcsh Summary: An enhanced version of csh, the C shell Version: 6.20.00 -Release: 9%{?dist} +Release: 12%{?dist} License: BSD URL: http://www.tcsh.org/ @@ -52,6 +52,8 @@ Patch006: tcsh-6.20.00-006-cleanup-in-readme-files.patch Patch007: tcsh-6.20.00-007-look-for-tgetent-in-libtinfo.patch Patch008: tcsh-6.20.00-008-guard-ascii-only-reversion.patch Patch009: tcsh-6.20.00-009-fix-regexp-for-backlash-quoting-tests.patch +Patch010: tcsh-6.20.00-010-fix-memory-consumption-while-loading-corrupted-history.patch +Patch011: tcsh-6.20.00-011-fix-infinite-loop-after-ctrlC.patch # Downstream patches -- these should be always included when doing rebase: @@ -186,6 +188,15 @@ fi # ============================================================================= %changelog +* Fri Nov 01 2019 Jan Macku - 6.20.00-12 +- rebuilt + +* Fri Nov 01 2019 Jan Macku - 6.20.00-11 +- rebuilt + +* Thu Oct 31 2019 Jan Macku - 6.20.00-10 +- fix for rapid memory consumption caused by corrupted history (#1765649) + * Fri Feb 09 2018 Fedora Release Engineering - 6.20.00-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild