]> git.ipfire.org Git - thirdparty/coreutils.git/commit
dd: improve integer overflow checking
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 18 Jan 2022 21:22:02 +0000 (13:22 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 27 Jan 2022 21:04:14 +0000 (13:04 -0800)
commite94d95075dd919e5e6ec0c8ed09477e58b863788
treefb8ba33c2f594a720c9a5bc76ced7042640ab9fe
parente462d928b0025bee0d67d33c7bb774884d3dd9c0
dd: improve integer overflow checking

* src/dd.c: Prefer signed to unsigned types where either will do,
as this helps improve checking with gcc -fsanitize=undefined.
Limit the signed types to their intended ranges.
(MAX_BLOCKSIZE): Don’t exceed IDX_MAX - slop either.
(input_offset_overflow): Remove; overflow now denoted by negative.
(parse_integer): Return INTMAX_MAX on overflow, instead of unspecified.
Do not falsely report overflow for ‘00x99999999999999999999999999999’.
* tests/dd/misc.sh: New test for 00xBIG.
* tests/dd/skip-seek-past-file.sh: Adjust to new diagnostic wording.
New test for BIGxBIG.
src/dd.c
tests/dd/misc.sh
tests/dd/skip-seek-past-file.sh