t-double.c (memory clobbered before allocated block)

Michael Tate michael.tate at wanadoo.fr
Wed Feb 27 15:11:12 CET 2013


Hello to everybody,

This is in reference to a short report I submitted recently concerning a 
possible
bug in t-double.c

Thank you for copying me in on your discussions by the way. I have run 
t-double against
gdb and at the risk of telling you something you already know and 
clearly understand much better
than me, here is what I found.

The memory allocation error triggers when free(buf) is called in the 
dump function, buf is set
via the mpz-get-str function. By allocating a character buffer inside 
the dump function, the dump
function completes correctly and then aborts the test segment as 
intended. I do not know
why the test itself fails.

A small patch for t-double.c is attached.

Best wishes
Mike



-------------- next part --------------
A non-text attachment was scrubbed...
Name: t-double.patch
Type: text/x-patch
Size: 644 bytes
Desc: not available
URL: <http://gmplib.org/list-archives/gmp-bugs/attachments/20130227/4e0f8b22/attachment.bin>


More information about the gmp-bugs mailing list