bug#37585: Undefined behavior in nl, print_lineno

2019-10-03 Thread Paul Eggert
On 10/2/19 7:50 AM, Roland Illig wrote: The current code says: next_line_no = line_no + page_incr; if (next_line_no < line_no) die (EXIT_FAILURE, 0, _("line number overflow")); Since intmax_t is a regular integer type, overflow invokes undefined behavior and must therefore be

bug#37585: Undefined behavior in nl, print_lineno

2019-10-02 Thread Roland Illig
The current code says: next_line_no = line_no + page_incr; if (next_line_no < line_no) die (EXIT_FAILURE, 0, _("line number overflow")); Since intmax_t is a regular integer type, overflow invokes undefined behavior and must therefore be checked using other means.