emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#37585: closed (Undefined behavior in nl, print_lin


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#37585: closed (Undefined behavior in nl, print_lineno)
Date: Thu, 03 Oct 2019 19:45:02 +0000

Your message dated Thu, 3 Oct 2019 12:43:54 -0700
with message-id <address@hidden>
and subject line Re: bug#37585: Undefined behavior in nl, print_lineno
has caused the debbugs.gnu.org bug report #37585,
regarding Undefined behavior in nl, print_lineno
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
37585: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37585
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 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.



--- End Message ---
--- Begin Message --- Subject: Re: bug#37585: Undefined behavior in nl, print_lineno Date: Thu, 3 Oct 2019 12:43:54 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0
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 checked using other means.

Thanks for the bug report. I looked for similar problems involving integer-overflow diagnostics in coreutils and installed the attached patches. The second patch should fix the bug you mentioned.

Attachment: 0001-cp-simplify-integer-overflow-checking.patch
Description: Text Data

Attachment: 0002-nl-fix-integer-overflow-bug.patch
Description: Text Data

Attachment: 0003-numfmt-avoid-unlikely-integer-overflow.patch
Description: Text Data

Attachment: 0004-truncate-avoid-integer-overflow-assumptions.patch
Description: Text Data


--- End Message ---

reply via email to

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