1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [pycrypto] Possible problem in src/_fastmath.c
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Possible%20problem%20in%20src/_fastmath.c&In-Reply-To=20081016120832.GA31863%40rivest.dlitz.net">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000024.html">
<LINK REL="Next" HREF="000026.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[pycrypto] Possible problem in src/_fastmath.c</H1>
<B>Dwayne C. Litzenberger</B>
<A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Possible%20problem%20in%20src/_fastmath.c&In-Reply-To=20081016120832.GA31863%40rivest.dlitz.net"
TITLE="[pycrypto] Possible problem in src/_fastmath.c">dlitz at dlitz.net
</A><BR>
<I>Thu Oct 16 06:13:38 CST 2008</I>
<P><UL>
<LI>Previous message: <A HREF="000024.html">[pycrypto] Possible problem in src/_fastmath.c
</A></li>
<LI>Next message: <A HREF="000026.html">[pycrypto] Possible problem in src/_fastmath.c
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#25">[ date ]</a>
<a href="thread.html#25">[ thread ]</a>
<a href="subject.html#25">[ subject ]</a>
<a href="author.html#25">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>On Thu, Oct 16, 2008 at 08:08:32AM -0400, Dwayne C. Litzenberger wrote:
><i> On Thu, Oct 16, 2008 at 03:39:29AM +0400, Sergey Chernov wrote:
</I>>><i> See patch:
</I>>><i> ----------------------------------------------------------------------------
</I>>><i> diff --git a/src/_fastmath.c b/src/_fastmath.c
</I>>><i> index d06d697..a0aa181 100755
</I>>><i> --- a/src/_fastmath.c
</I>>><i> +++ b/src/_fastmath.c
</I>>><i> @@ -28,6 +28,7 @@ longObjToMPZ (mpz_t m, PyLongObject * p)
</I>>><i> size = p->ob_size;
</I>>><i> else
</I>>><i> size = -p->ob_size;
</I>>><i> + mpz_clear( m );
</I>>><i> for (i = 0; i < size; i++)
</I>>><i> {
</I>>><i> mpz_set_ui (temp, p->ob_digit[i]);
</I>>><i> ----------------------------------------------------------------------------
</I>>><i>
</I>>><i> Current usage do not discover the bug as 'm' is always just-initialized.
</I>>><i> Still it, as I think, may cause trouble later.
</I>><i>
</I>><i> Sergey,
</I>><i>
</I>><i> What is the purpose of your patch? What bug are you referring to?
</I>><i>
</I>><i> Are you trying to set m to zero at the top of the loop? Looking at the GMP
</I>><i> documentation (<A HREF="http://gmplib.org/manual/Initializing-Integers.html">http://gmplib.org/manual/Initializing-Integers.html</A>), I see
</I>><i> that mpz_init() and mpz_clear() have similar usages as malloc() and free(),
</I>><i> so I'm pretty sure that I do not want to apply your patch as-is.
</I>
Perhaps you meant this?
-------------------------------------------------------------------------------
diff --git a/src/_fastmath.c b/src/_fastmath.c
index d06d697..caf8e7b 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_set_ui (m, 0);
for (i = 0; i < size; i++)
{
mpz_set_ui (temp, p->ob_digit[i]);
-------------------------------------------------------------------------------
--
Dwayne C. Litzenberger <<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">dlitz at dlitz.net</A>>
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 : <A HREF="http://lists.dlitz.net/pipermail/pycrypto/attachments/20081016/d0a14b31/attachment.pgp">http://lists.dlitz.net/pipermail/pycrypto/attachments/20081016/d0a14b31/attachment.pgp</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000024.html">[pycrypto] Possible problem in src/_fastmath.c
</A></li>
<LI>Next message: <A HREF="000026.html">[pycrypto] Possible problem in src/_fastmath.c
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#25">[ date ]</a>
<a href="thread.html#25">[ thread ]</a>
<a href="subject.html#25">[ subject ]</a>
<a href="author.html#25">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">More information about the pycrypto
mailing list</a><br>
</body></html>
|