From 2e636af1ef3f6a5ef872bdd2297dd25198c69395 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 7 Feb 2011 08:29:33 +0100 Subject: cut: don't segfault for large unbounded range * src/cut.c (set_fields): When computing the maximum range endpoint, take into consideration the start of any unbounded range, like "999-". * NEWS (Bug fixes): Mention it. * tests/misc/cut (big-unbounded-b,c,f): Add tests. Reported by Paul Marinescu in http://debbugs.gnu.org/7993 The bug was introduced on 2004-12-04 via commit 7380cf79. --- tests/misc/cut | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/misc/cut b/tests/misc/cut index 435399463..c905ba9a3 100755 --- a/tests/misc/cut +++ b/tests/misc/cut @@ -150,6 +150,10 @@ my @Tests = {ERR=>$no_endpoint}], ['inval5', '-f', '1-,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], ['inval6', '-f', '-1,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}], + # This would evoke a segfault from 5.3.0..6.10 + ['big-unbounded-b', '--output-d=:', '-b1234567890-', {IN=>''}, {OUT=>''}], + ['big-unbounded-c', '--output-d=:', '-c1234567890-', {IN=>''}, {OUT=>''}], + ['big-unbounded-f', '--output-d=:', '-f1234567890-', {IN=>''}, {OUT=>''}], ); @Tests = triple_test \@Tests; -- cgit v1.2.3-54-g00ecf