]> git.ipfire.org Git - thirdparty/coreutils.git/commit
wc: diagnose overflow of total counts
authorPádraig Brady <P@draigBrady.com>
Wed, 29 Mar 2023 14:29:52 +0000 (15:29 +0100)
committerPádraig Brady <P@draigBrady.com>
Fri, 31 Mar 2023 10:58:49 +0000 (11:58 +0100)
commit7ad749886cddc76860bd8cfc38a408032a5e4c99
tree3ec78d113e52c0579a1e80411bd04d7c6a4ff437
parenta9bd274616a8d2e99736b498e657cda4e6954f3f
wc: diagnose overflow of total counts

* src/wc.c (wc): Use INT_ADD_WRAPV() to detect overflow.
(main): Upon overflow, saturate the total, print a diagnostic,
and set exit status.
* tests/misc/wc-total.sh: Add a test case, which operates
on BTRFS and 64 bit systems at least.
Reported at https://bugs.debian.org/1027100
NEWS
src/wc.c
tests/misc/wc-total.sh