[PATCH] mini-gmp: pass correct old_size to custom reallocate function

minux minux.ma at gmail.com
Mon Mar 9 12:04:03 UTC 2020


Hello,

On Mon, Mar 9, 2020 at 6:23 AM Marco Bodrato <bodrato at mail.dm.unipi.it> wrote:
>
> Ciao,
>
> Il 2020-03-07 21:27 minux ha scritto:
> > All comments addressed, except as noted below.
> > I also fixed similar issues in mini-mpq.c changes.
> >
> > On Sat, Mar 7, 2020 at 2:26 PM Niels Möller <nisse at lysator.liu.se>
> > wrote:
> >> minux <minux.ma at gmail.com> writes:
>
> >> I'm not that familiar with the mpq functions. I hope Marco can
> >> comment.
>
> I had problems with my e-mail adress, but I'm here again :-)
>
> Maybe there are some unneeded initialisations = NULL, but details can
> also be refined later...
>
> There is an undocumented "feature" that the proposed patch breaks:
> "safe" failure when the base is out of range.
> The question is, should we keep it or not, document it or not, should
> GMP and mini-gmp agree?
>
> I attach a possible patch for tests that check that feature.

IMO, it's better to keep behavior of mini-gmp and gmp as consistent as
possible, to minimize surprises.
I added a check for out-of-range base to the beginning of mpq_get_str
and incorporated your patch to the mini-gmp test (I didn't include the
one in main gmp test suite though, as I think it's out of scope for
this patch.)

Please take another look at the attached patch. All existing comments addressed.

Thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mini-gmp.patch
Type: application/octet-stream
Size: 12569 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-devel/attachments/20200309/9fdbc3b0/attachment-0001.obj>


More information about the gmp-devel mailing list