Re: [PATCH] Fix integer overflow test in parse_int

2024-03-28 Thread Paul Smith
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 == '

Re: [PATCH] Fix integer overflow test in parse_int

2024-01-07 Thread John Reiser
On 1/7/24 16:09, 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,

[PATCH] Fix integer overflow test in parse_int

2024-01-07 Thread Paul Eggert
* 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') yiel