File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 2121 * This is dtoa.c by David M. Gay, downloaded from
2222 * http://www.netlib.org/fp/dtoa.c on April 15, 2009 and modified for
2323 * inclusion into the Python core by Mark E. T. Dickinson and Eric V. Smith.
24- * The major modifications are as follows:
24+ *
25+ * Please remember to check http://www.netlib.org/fp regularly (and especially
26+ * before any Python release) for bugfixes and updates.
27+ *
28+ * The major modifications from Gay's original code are as follows:
2529 *
2630 * 0. The original code has been specialized to Python's needs by removing
2731 * many of the #ifdef'd sections. In particular, code to support VAX and
5357 * 5. The code has been reformatted to better fit with Python's
5458 * C style guide (PEP 7).
5559 *
60+ * 6. A bug in the memory allocation has been fixed: to avoid FREEing memory
61+ * that hasn't been MALLOC'ed, private_mem should only be used when k <=
62+ * Kmax.
63+ *
5664 ***************************************************************/
5765
5866/* Please send bug reports for the original dtoa.c code to David M. Gay (dmg
@@ -342,7 +350,7 @@ Balloc(int k)
342350 x = 1 << k ;
343351 len = (sizeof (Bigint ) + (x - 1 )* sizeof (ULong ) + sizeof (double ) - 1 )
344352 /sizeof (double );
345- if (pmem_next - private_mem + len <= PRIVATE_mem ) {
353+ if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem ) {
346354 rv = (Bigint * )pmem_next ;
347355 pmem_next += len ;
348356 }
You can’t perform that action at this time.
0 commit comments