On Sun, 2024-01-07 at 16:09 -0800, Paul Eggert wrote:
> * src/arscan.c (parse_int): Use intprops.h macros rather than trying
> to detect integer overflow by hand, and doing it incorrectly.
> Here is an example of why the old code was incorrect.
> If val == 3689348814741910323, base == 10, *ptr == '0', UINTMAX_WIDTH
> == 64,
> then (val * base) + (*ptr - '0') yields 18446744073709551614,
> which is greater than val even though overflow has occurred.
> Fortunately this bug could not be triggered on GNU/Linux hosts,
> although it may be possible on platforms (if any) where struct ar_hdr
> has members so large that they can represent integers that do not fit
> int uintmax_t.

I applied this, thanks for the patch Paul!

-- 
Paul D. Smith <psm...@gnu.org>            Find some GNU Make tips at:
https://www.gnu.org                       http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad
Scientist




Reply via email to