summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-04-17 16:06:28 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-04-17 16:06:28 (GMT)
commit7f0ea323ee99a06cb8075151403125e0b928137c (patch)
tree92d05b7be35854213c094585d584cab754c965fd /Python
parentf633ff4546a4d044803ea83901e8c4ea0ee60e87 (diff)
downloadcpython-7f0ea323ee99a06cb8075151403125e0b928137c.zip
cpython-7f0ea323ee99a06cb8075151403125e0b928137c.tar.gz
cpython-7f0ea323ee99a06cb8075151403125e0b928137c.tar.bz2
Add reminder to dtoa.c to check for updates regularly.
Fix a bug in the memory management in dtoa.c.
Diffstat (limited to 'Python')
-rw-r--r--Python/dtoa.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/dtoa.c b/Python/dtoa.c
index 645e976..9d0f5e5 100644
--- a/Python/dtoa.c
+++ b/Python/dtoa.c
@@ -21,7 +21,11 @@
* This is dtoa.c by David M. Gay, downloaded from
* http://www.netlib.org/fp/dtoa.c on April 15, 2009 and modified for
* inclusion into the Python core by Mark E. T. Dickinson and Eric V. Smith.
- * The major modifications are as follows:
+ *
+ * Please remember to check http://www.netlib.org/fp regularly (and especially
+ * before any Python release) for bugfixes and updates.
+ *
+ * The major modifications from Gay's original code are as follows:
*
* 0. The original code has been specialized to Python's needs by removing
* many of the #ifdef'd sections. In particular, code to support VAX and
@@ -53,6 +57,10 @@
* 5. The code has been reformatted to better fit with Python's
* C style guide (PEP 7).
*
+ * 6. A bug in the memory allocation has been fixed: to avoid FREEing memory
+ * that hasn't been MALLOC'ed, private_mem should only be used when k <=
+ * Kmax.
+ *
***************************************************************/
/* Please send bug reports for the original dtoa.c code to David M. Gay (dmg
@@ -342,7 +350,7 @@ Balloc(int k)
x = 1 << k;
len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
/sizeof(double);
- if (pmem_next - private_mem + len <= PRIVATE_mem) {
+ if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) {
rv = (Bigint*)pmem_next;
pmem_next += len;
}