Skip to content

Commit 7d1eef4

Browse files
committed
Fixed bug #54332 (Crash in zend_mm_check_ptr // Heap corruption)
1 parent 5d5951f commit 7d1eef4

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PHP NEWS
66
though the class has none). (Felipe)
77

88
- Core
9+
. Fixed bug #54332 (Crash in zend_mm_check_ptr // Heap corruption). (Dmitry)
910
. Fixed bug #53727 (Inconsistent behavior of is_subclass_of with interfaces)
1011
(Ralph Schindler, Dmitry)
1112
. Fixed buffer overflow on overlog salt in crypt(). (Clément LECIGNE, Stas)
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--TEST--
2+
Bug #54332 (Crash in zend_mm_check_ptr // Heap corruption)
3+
--FILE--
4+
<?php
5+
echo number_format(1e300, 2006, '', ' ') . "\n";
6+
?>
7+
--EXPECT--
8+
1 000 000 000 000 000 052 504 760 255 204 420 248 704 468 581 108 159 154 915 854 115 511 802 457 988 908 195 786 371 375 080 447 864 043 704 443 832 883 878 176 942 523 235 360 430 575 644 792 184 786 706 982 848 387 200 926 575 803 737 830 233 794 788 090 059 368 953 234 970 799 945 081 119 038 967 640 880 074 652 742 780 142 494 579 258 788 820 056 842 838 115 669 472 196 386 865 459 400 540 16000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

main/snprintf.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,11 @@ char * ap_php_conv_p2(register u_wide_int num, register int nbits, char format,
497497
* NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
498498
*
499499
* XXX: this is a magic number; do not decrease it
500+
* Emax = 1023
501+
* NDIG = 320
502+
* NUM_BUF_SIZE >= strlen("-") + Emax + strlrn(".") + NDIG + strlen("E+1023") + 1;
500503
*/
501-
#define NUM_BUF_SIZE 512
504+
#define NUM_BUF_SIZE 2048
502505

503506

504507
/*

main/spprintf.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@
119119
* NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
120120
*
121121
* XXX: this is a magic number; do not decrease it
122+
* Emax = 1023
123+
* NDIG = 320
124+
* NUM_BUF_SIZE >= strlen("-") + Emax + strlrn(".") + NDIG + strlen("E+1023") + 1;
122125
*/
123-
#define NUM_BUF_SIZE 512
126+
#define NUM_BUF_SIZE 2048
124127

125128
/*
126129
* The INS_CHAR macro inserts a character in the buffer.

0 commit comments

Comments
 (0)