Bug 83056

Summary: textutils /bin/cut input validation error
Product: [Retired] Red Hat Linux Reporter: Wojtek Sobola <wojciech.sobola>
Component: textutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED CURRENTRELEASE QA Contact: Ben Levenson <benl>
Severity: high Docs Contact:
Priority: medium    
Version: 8.0CC: mitr
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-10 13:08:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wojtek Sobola 2003-01-29 21:28:19 UTC
Description of problem:
/bin/cut has following input validation problem:

22:16:34 [wojtek ~]$ gdb /bin/cut
GNU gdb Red Hat Linux (5.2.1-4)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...(no debugging symbols found)...
(gdb) run -b -9999999999999999
Starting program: /bin/cut -b -9999999999999999
/bin/cut: memory exhausted
(no debugging symbols found)...(no debugging symbols found)...
Program exited with code 01.
(gdb) run -b -9999999999999999999999999999999999999999
Starting program: /bin/cut -b -9999999999999999999999999999999999999999
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x08048fbf in set_fields ()
(gdb) bt
#0  0x08048fbf in set_fields ()
#1  0x0804995c in main ()
#2  0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
(gdb)

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

How reproducible:
/bin/cut -b -99999999999999999999999999999999

Steps to Reproduce:
1. above
2.
3.
    
Actual results:
SIGSEGV or Mem Exhausted

Expected results:


Additional info:
Can lead to overwrite mem of other processes (not checked).

Comment 1 Tim Waugh 2003-01-29 23:37:35 UTC
> Can lead to overwrite mem of other processes (not checked).

Linux uses memory protection to prevent one process from accidentally
overwriting the memory of another.

But I agree that it's bad behaviour for cut.