[pycrypto] Possible problem in src/_fastmath.c
Dwayne C. Litzenberger
dlitz at dlitz.net
Thu Oct 16 06:08:32 CST 2008
On Thu, Oct 16, 2008 at 03:39:29AM +0400, Sergey Chernov wrote:
>See patch:
>----------------------------------------------------------------------------
>diff --git a/src/_fastmath.c b/src/_fastmath.c
>index d06d697..a0aa181 100755
>--- a/src/_fastmath.c
>+++ b/src/_fastmath.c
>@@ -28,6 +28,7 @@ longObjToMPZ (mpz_t m, PyLongObject * p)
> size = p->ob_size;
> else
> size = -p->ob_size;
>+ mpz_clear( m );
> for (i = 0; i < size; i++)
> {
> mpz_set_ui (temp, p->ob_digit[i]);
>----------------------------------------------------------------------------
>
>Current usage do not discover the bug as 'm' is always just-initialized.
>Still it, as I think, may cause trouble later.
Sergey,
What is the purpose of your patch? What bug are you referring to?
Are you trying to set m to zero at the top of the loop? Looking at the GMP
documentation (http://gmplib.org/manual/Initializing-Integers.html), I see
that mpz_init() and mpz_clear() have similar usages as malloc() and free(),
so I'm pretty sure that I do not want to apply your patch as-is.
- Dwayne
--
Dwayne C. Litzenberger <dlitz at dlitz.net>
Key-signing key - 19E1 1FE8 B3CF F273 ED17 4A24 928C EC13 39C2 5CF7
Annual key (2008) - 4B2A FD82 FC7D 9E38 38D9 179F 1C11 B877 E780 4B45
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.dlitz.net/pipermail/pycrypto/attachments/20081016/7e4197a5/attachment.pgp
More information about the pycrypto
mailing list