[Bug 190735] truncate(1) integer overflow issues with size command line arg -- diff with unit tests attached
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190735 --- Comment #4 from commit-h...@freebsd.org --- A commit references this bug: Author: jilles Date: Mon Jun 9 10:39:56 UTC 2014 New revision: 267265 URL: http://svnweb.freebsd.org/changeset/base/267265 Log: truncate: Detect integer overflow, fix relative sizes, add tests. The change to expand_number (r204654) broke detection of too large sizes and relative sizes ('+'/'-'). Also add some tests. PR:190735 Submitted by:Kirk Russell MFC after:1 week Changes: head/etc/mtree/BSD.tests.dist head/usr.bin/truncate/Makefile head/usr.bin/truncate/tests/ head/usr.bin/truncate/tests/Makefile head/usr.bin/truncate/tests/truncate_test.sh head/usr.bin/truncate/truncate.c -- You are receiving this mail because: You are the assignee for the bug. ___ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to freebsd-bugs-unsubscr...@freebsd.org
[Bug 190735] truncate(1) integer overflow issues with size command line arg -- diff with unit tests attached
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190735 Jilles Tjoelker jil...@freebsd.org changed: What|Removed |Added Status|In Discussion |Needs MFC Assignee|freebsd-bugs@FreeBSD.org|jil...@freebsd.org --- Comment #5 from Jilles Tjoelker jil...@freebsd.org --- Applied to 11-current, with some changes (fixing buildworld/installworld WITH_TESTS=YES, removing duplicate test, fixing some test descriptions). -- You are receiving this mail because: You are the assignee for the bug. ___ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to freebsd-bugs-unsubscr...@freebsd.org
[Bug 190735] truncate(1) integer overflow issues with size command line arg -- diff with unit tests attached
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190735 Jilles Tjoelker jil...@freebsd.org changed: What|Removed |Added Status|Needs Triage|In Discussion CC||jil...@freebsd.org --- Comment #1 from Jilles Tjoelker jil...@freebsd.org --- This looks useful. Is it possible to do without the new undocumented -D option? Perhaps you could ktrace for truncate(2) calls or add numbers to error messages. (A truncate() to something close to OFF_MAX should certainly not be expected to work, so checking for sizes of files may not be sufficient.) Instead of the PRIdMAX macro from inttypes.h, please use jd. -- You are receiving this mail because: You are the assignee for the bug. ___ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to freebsd-bugs-unsubscr...@freebsd.org
[Bug 190735] truncate(1) integer overflow issues with size command line arg -- diff with unit tests attached
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190735 --- Comment #2 from Kirk Russell bugmeis...@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 0x7fff 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. ___ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to freebsd-bugs-unsubscr...@freebsd.org
[Bug 190735] truncate(1) integer overflow issues with size command line arg -- diff with unit tests attached
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190735 --- Comment #3 from Kirk Russell bugmeis...@ba23.org --- Created attachment 143501 -- https://bugs.freebsd.org/bugzilla/attachment.cgi?id=143501action=edit A second patch with the recommend changes. -- You are receiving this mail because: You are the assignee for the bug. ___ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to freebsd-bugs-unsubscr...@freebsd.org