Hi,

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
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

Attachment: mini-gmp.patch
Description: Binary data

_______________________________________________
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel

Reply via email to