Bug 1901030

Summary: tcsh segfaults if non-ASCII characters are entered in a terminal configured to use 8-bit characters and LANG=en_US.UTF-8
Product: Red Hat Enterprise Linux 8 Reporter: Carlos Santos <casantos>
Component: tcshAssignee: Siteshwar Vashisht <svashisht>
Status: CLOSED WONTFIX QA Contact: Karel Volný <kvolny>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.3CC: alrodrig, chorn, joburati, mkolbas, sujagtap
Target Milestone: rc   
Target Release: 8.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-10 12:06:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Carlos Santos 2020-11-24 10:33:35 UTC
Description of problem:

tcsh segfaults if non-ascii characters are entered in a terminal configured to
use 8-bit characters and LANG=en_US.UTF-8.

Version-Release number of selected component (if applicable):

tcsh-6.20.00-12.el8.x86_64

How reproducible:

always

Steps to Reproduce:

1. Use a terminal emulator (e.g. Gnome Terminal) configured for ISO8859-1.
2. Set locale/LANG to en_US.UTF-8.
3. Run tcsh.
4. Enter some non-ascii characters on the command line (e.g. ç ã ä).

Actual results:

The shell segfaults efter a short while. Pressing return, backspace or any
other key 5 times makes it crash faster.

Expected results:

tcsh should not crash

Additional info:

The problem has been fixed in tcsh 6.21 by the following commits

commit 49abb8817d18103cf3988df80c7ca0ded63b6596
Author: zoulasc <christos>
Date:   Fri Apr 26 16:09:39 2019 -0400

    Fix prototype inconsistency (Corinna Vinschen)

commit e120c55b6da0b68ef7adec3158ff5c45b14c52e7
Author: Amol Deshpande <amold.com>
Date:   Tue Feb 26 06:30:09 2019 +0000

    Accidentally reversed #ifdef

commit a7a11fda9081a214f1c0a7cd777ce709c22ed27c
Author: Amol Deshpande <amold.com>
Date:   Tue Feb 26 06:24:33 2019 +0000

    Fix breakage of NT bindkeys

commit 1a9cf9aae4674b93f163a81ffab5457299fb10e1
Author: zoulasc <christos>
Date:   Sun Dec 16 13:42:28 2018 -0500

    Fix PR/37: Segv on array dereference.

commit 97449dbf9c0f1bdeb9ce580658f9a325cff07a03
Author: zoulasc <christos>
Date:   Fri Apr 28 09:14:30 2017 -0400

    Handle 8-bit characters in bindkey (Dr. Werner Fink)

commit 8e6dfd53321a0b0047f7d75db21a946c166c600b
Author: Christos Zoulas <christos>
Date:   Fri Feb 17 11:17:27 2017 -0500

    Unfortunately the AsciiOnly reversion causes a SEGV because *ch
    is used to index in the command array, and now contains INVALID_BYTE.
    env -i ./tcsh
    <meta>b

tcsh-6.20.00-12.el8 has commit 8e6dfd53321a0b0047f7d75db21a946c166c600b
applied as tcsh-6.20.00-008-guard-ascii-only-reversion.patch. I suggest to
either cherry-pick the missing five patches or upgrade to 6.21.