Uninitialized memory bug found in /mpn/generic/mod_1_1.c
marco.bodrato at tutanota.com
marco.bodrato at tutanota.com
Thu Aug 31 19:33:46 CEST 2023
Ciao,
31 ago 2023, 18:06 da vincent at vinc17.net:
> I don't think that this is sufficient for the test.
> The code Brett mentioned is for MOD_1_1P_METHOD = 2.
>
The code Brett mentioned is mixed, I fear.
Looking at mpn/generic/mod_1_1.c,if MOD_1_1P_METHOD == 1, the value[2] in the array is always set and always used;
if MOD_1_1P_METHOD == 2, the value[2] is set only if cnt!=0, and it is used only if cnt!=0.
There are also some assembler code implementations, each one with its couple of functions.
> So, in mpn/generic/mod_1_1.c, I also changed
> # define MOD_1_1P_METHOD 1 /* need to make sure this is 2 for asm testing */
>
Not enough, MOD_1_1P_METHOD may be defined by gmp-mparam.h
One should also check how MOD_1N_TO_MOD_1_1_THRESHOLD interact with the tests.
> ASSERT (bmodb[2] != -1);
>
> But even with that, I don't get any failure.
>
Actually it is possible to trigger this, if you put it in the wrong place, I mean, outside the branch actually using the value... but it is not interesting.
Ĝis,
Marco
More information about the gmp-bugs
mailing list