Subject: bug#7993: closed (Re: bug#7993: Acknowledgement (cut segmentation fault with unbounded ranges))

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 07 Feb 2011 07:37:02 +0000

Your bug report

#7993: cut segmentation fault with unbounded ranges

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
7993: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7993
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#7993: Acknowledgement (cut segmentation fault with unbounded ranges)
From: Jim Meyering <[email-masked]>
To: Paul Marinescu <[email-masked]>
Cc: [email-masked]
Date: Mon, 07 Feb 2011 08:45:36 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

> Please ignore this. It's a duplicate submission of bug# 7992

Ok.  marking it closed.

Subject: cut segmentation fault with unbounded ranges
From: Paul Marinescu <[email-masked]>
To: [email-masked]
Date: Sun, 06 Feb 2011 18:20:11 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

In coreutils 8.9 (latest), the following commands trigger an invalid
memory access.

cut -c1234567890- --output-d=: foo
cut -f1234567890- --output-d=: foo
cut -b1234567890- --output-d=: foo

The number 1234567890 is just a random number 'big enough' to make the
invalid access generate a segmentation fault but the invalid access
happens for values as low as 8 (valgrind)

The problem is that ranges going to end of line (i.e., 'x-') are not
taken into account when calculating the size of the printable_field
vector, but their lower bound is used as an index on line 525:

  if (output_delimiter_specified
      && !complement
      && eol_range_start && !is_printable_field (eol_range_start))

Paul