[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] factor: fix integer validation and GMP fallback
From: |
Jim Meyering |
Subject: |
Re: [PATCH] factor: fix integer validation and GMP fallback |
Date: |
Mon, 08 Oct 2012 18:25:31 +0200 |
Pádraig Brady wrote:
> In the recent factor rewrite, the GMP code
> wasn't actually used; just an error was printed
> on integer overflow. While fixing that it was noticed
> that correct input validation wasn't done in all cases
> when falling back to the GMP code.
>
> * src/factor.c (print_factors) Fallback to GMP on overflow.
> (strto2uintmax): Scan the string for invalid characters,
> so that can be detected independently of overflow.
> Return an error when an empty string is passed.
Oh, wow. I'm sure glad you caught that. Thanks!
I could have sworn there was a test that used GMP when possible.
I'll add one ASAP.