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

2020-03-12 Thread minux
On Thu, Mar 12, 2020 at 3:19 PM Niels Möller wrote: > minux writes: > > Indeed, this is much simpler and avoids the risk of calling > > strlen(NULL). Thanks. > > > > Patch updated. Please take another look. > > Looks good to me. I was about to submit, but then

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

2020-03-09 Thread minux
Hello, On Mon, Mar 9, 2020 at 8:43 AM Marco Bodrato wrote: > Il 2020-03-09 13:04 minux ha scritto: > > I added a check for out-of-range base to the beginning of mpq_get_str > > I'd prefer to let checking ranges outside of the mpq code. > If res==NULL for whatever reason

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

2020-03-09 Thread minux
Hello, On Mon, Mar 9, 2020 at 6:23 AM Marco Bodrato 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

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

2020-03-07 Thread minux
On Sat, Mar 7, 2020 at 10:20 AM Niels Möller wrote: > minux writes: > > > Yes, the old_size is supposed to be the size of the originally > > allocated memory block. But the problem is that some old gmp client > > used to rely on the old_size behave as documented: > &

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

2020-03-07 Thread minux
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 wrote: > minux writes: > > Because we don't have separate docs for mini-gmp, and mini-gmp does > > provide mp_set_memory_functions,

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

2020-03-07 Thread minux
On Sat, Mar 7, 2020 at 3:42 AM Niels Möller wrote: > > According to GMP documentation chapter 13 for reallocate_function: > > "The block may be moved if necessary or if desired, and in that case > > the smaller of old_size and new_size bytes must be copied to the new > > location." > > As I unders

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

2020-03-06 Thread minux
ize to the reallocate function if it wants the old data to be preserved. I have modified mini-gmp and its testsuite to conform to this definition from GMP. Patch against the latest hg tip (c44538397385) is attached. Thanks! Sincerely, Minux mini-gmp.patch Description: B