Andreas Schwab wrote: > But the sum can overflow, and since the involved types are > unsigned this has defined (wrap-around) behaviour.
Thanks. I felt I must be overlooking something, but couldn't figure out what. > > Further, the Open Group says that 'od' should not produce an > > error when '-j' plus '-N' is longer than the file, so the above > > section can be removed. > > This is a good point, however. But end_offset should then be set > to (uintmax_t)-1 on overflow. Setting end_offset to the largest possible integer upon overflow will probably do the right thing in all practical cases; but if the file is really longer than an integer can represent, it would then output the wrong number of bytes. Better print an error message instead then. $ od -j1 -N18446744073709551615 testfile od: skip-bytes + read-bytes is too large $ od -j1 -N18446744073709551616 testfile od: -N argument `18446744073709551616' too large $ od -j18446744073709551616 -N1 testfile od: -j argument `18446744073709551616' too large $ od -j18446744073709551615 -N1 testmail.k od: skip-bytes + read-bytes is too large Benno _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils