diff options
author | Jim Meyering <meyering@redhat.com> | 2011-02-07 08:29:33 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-02-07 09:25:51 +0100 |
commit | 2e636af1ef3f6a5ef872bdd2297dd25198c69395 (patch) | |
tree | 11170c0518c022cbb831d5e9f5a775e38397b4a8 /src | |
parent | 9f618068755b51d19b22c52bc4a2f8084946948e (diff) | |
download | coreutils-2e636af1ef3f6a5ef872bdd2297dd25198c69395.tar.xz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/cut.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -496,6 +496,8 @@ set_fields (const char *fieldstr) if (rp[i].hi > max_range_endpoint) max_range_endpoint = rp[i].hi; } + if (max_range_endpoint < eol_range_start) + max_range_endpoint = eol_range_start; /* Allocate an array large enough so that it may be indexed by the field numbers corresponding to all finite ranges |