[PATCH] mini-gmp: pass correct old_size to custom reallocate function
minux.ma at gmail.com
Sat Feb 22 11:23:26 UTC 2020
mini-gmp currently always passes old_size == 0 to the custom
reallocate function, causing custom allocators for GMP that use
old_size to determine the amount of data to copy data to newly
allocated space to malfunction with mini-gmp.
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 in general mini-gmp cannot assume that the reallocate
function will not move the block, it should always pass non-zero
old_size to the reallocate function if it wants the old data to be
I have modified mini-gmp and its testsuite to conform to this
definition from GMP.
Patch against the latest hg tip (c44538397385) is attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2346 bytes
Desc: not available
More information about the gmp-devel