Benno Schulenberg <[EMAIL PROTECTED]> writes: > Hi, > > In src/od.c around line 1820 it says this: > > if (limit_bytes_to_format) > { > end_offset = n_bytes_to_skip + max_bytes_to_format; > if (end_offset < n_bytes_to_skip) > error (EXIT_FAILURE, 0, _("skip-bytes + read-bytes is too large")); > } > > Since max_bytes_to_format cannot be negative, the second 'if' will > never trigger, so the whole six lines are moot.
But the sum can overflow, and since the involved types are unsigned this has defined (wrap-around) behaviour. > 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. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils