https://bugs.busybox.net/show_bug.cgi?id=16054
Bug ID: 16054
Summary: du: size overflow
Product: Busybox
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Other
Assignee: unassigned at busybox.net
Reporter: sertonix at posteo.net
CC: busybox-cvs at busybox.net
Target Milestone: ---
Created attachment 9742
--> https://bugs.busybox.net/attachment.cgi?id=9742&action=edit
Minimal config
busybox `du` stores the size sum as `unsigned long long`. This works (with musl
at least) until ~16 Exabytes (`2^64-1`) but overflows beyond that due to
missing overflow check. This size can be reached with sparse files.
(Run in a tmpfs. Otherwise `dd` may throw size errors)
```sh
dd if=/dev/null bs=1 seek=$(echo '2^63-1' | bc) of=a
dd if=/dev/null bs=1 seek=$(echo '2^63-1' | bc) of=b
printf 12 > more
busybox du -bc a b
=> 18446744073709551614 total
busybox du -bc a b more
=> 0 total
```
The `du` implementation of coreutils prints `Infinity` and a 0 exit code. I
think a non zero exit code makes more sense but that is debatable.
Downstream issue: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16075
--
You are receiving this mail because:
You are on the CC list for the bug.