bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37585: Undefined behavior in nl, print_lineno


From: Roland Illig
Subject: bug#37585: Undefined behavior in nl, print_lineno
Date: Wed, 2 Oct 2019 16:50:53 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]