Subject: Re: bug#73474: Bug in factor utility of coreutils

From: Pádraig Brady <[email-masked]>
Date: Wed, 25 Sep 2024 21:48:50 +0100

On 25/09/2024 20:55, Paul Eggert wrote:
> On 2024-09-25 08:14, Pádraig Brady wrote:
>> It seems better to move the checks within the macro to avoid any future
>> issues.
>> I've also applied the same check to rsh2 in the attached.
> 
> That patch doesn't suffice (nor does Artem's) because the count can be
> negative. I'll take a further look at this.

Indeed. I had already added asserts just in case, and hit:

   $ src/factor 79228162514264337593543941441  factor: src/factor.c:427: mod2: Assertion `0 < cnt' failed.
   Aborted (core dumped)

Note factor does give the correct result on amd64 at least
without the asserts:

   $ factor 79228162514264337593543941441 | sed 's/.*: //; s/ /*/g' | bc
   79228162514264337593543941441

cheers,
Pádraig