Date: Sat, 07 Jun 2014 22:37:02 +0000 From: bz-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 190735] truncate(1) integer overflow issues with size command line arg -- diff with unit tests attached Message-ID: <bug-190735-8-4oJIqNFK9G@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-190735-8@https.bugs.freebsd.org/bugzilla/> References: <bug-190735-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190735 --- Comment #2 from Kirk Russell <bugmeister@ba23.org> --- Jilles, thanks for looking! I have removed the new undocumented -D option and stopped using the macro from <inttypes.h>. I like your idea of using ktrace but I will want to research that idea before including that in a diff -- I will remove this ktrace/-D stuff from the patch -- I hope that is okay. I will attach a new patch to this bug, with the new changes. You can clarify your comment the expectations of off_t being OFF_MAX? My idea is the truncate utility needs to indicate an error if OFF_MAX < size < OFF_MIN. The function humanize_number() will allow numbers out-of-range for off_t and we should tell the user as soon as possible about this conversion problem. What the OS does with an large off_t passed to truncate() is the OS's business. For example, it is possible to create a huge sparse file in ZFS. I am not sure what this sparse file is useful for, but it is nice to see that ls -h works. # printf "%d\n" 0x7fffffffffffffff 9223372036854775807 # /usr/obj/usr/src/usr.bin/truncate/truncate -s 9223372036854775807 sparse.txt # ls -l sparse.txt -rw-r--r-- 1 root wheel 9223372036854775807 Jun 7 18:30 sparse.txt # ls -lh sparse.txt -rw-r--r-- 1 root wheel 8.0E Jun 7 18:33 sparse.txt -- You are receiving this mail because: You are the assignee for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-190735-8-4oJIqNFK9G>
