diff options
author | Ron Yorston <rmy@pobox.com> | 2024-11-03 12:47:27 +0000 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2024-12-10 01:29:44 +0100 |
commit | f02041441344389b05d10fe6ba8759b6670b8e10 (patch) | |
tree | 4f1aa061fa703127606e1d1dbc05de1fbd8e1d6b /init | |
parent | 50e2b59370542097eb0efd79cc8d3d39ee52bf82 (diff) | |
download | busybox-w32-f02041441344389b05d10fe6ba8759b6670b8e10.tar.gz busybox-w32-f02041441344389b05d10fe6ba8759b6670b8e10.tar.bz2 busybox-w32-f02041441344389b05d10fe6ba8759b6670b8e10.zip |
cut: improve detection of invalid ranges
Commit 0068ce2fa (cut: add toybox-compatible options -O OUTSEP,
-D, -F LIST) added detection of reversed ranges. Further
improvements are possible.
- The test for reversed ranges compared the start after it had been
decremented with the end before decrement. It thus missed ranges
of the form 2-1.
- Zero isn't a valid start value for a range. (Nor is it a valid
end value, but that's caught by the test for a reversed range.)
- The code
if (!*ltok)
e = INT_MAX;
duplicates a check that's already been made.
- Display the actual range in the error message to make it easier
to find which range was at fault.
function old new delta
.rodata 100273 100287 +14
cut_main 1239 1237 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-2) Total: 12 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions