File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 5
5
- Core:
6
6
. Fixed bug #76901 (method_exists on SPL iterator passthrough method corrupts
7
7
memory). (Nikita)
8
+ . Fixed bug #76846 (Segfault in shutdown function after memory limit error).
9
+ (Nikita)
8
10
9
11
- CURL:
10
12
. Fixed bug #76480 (Use curl_multi_wait() so that timeouts are respected).
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #76846: Segfault in shutdown function after memory limit error
3
+ --INI--
4
+ memory_limit=33M
5
+ --SKIPIF--
6
+ <?php
7
+ $ zend_mm_enabled = getenv ("USE_ZEND_ALLOC " );
8
+ if ($ zend_mm_enabled === "0 " ) {
9
+ die ("skip Zend MM disabled " );
10
+ }
11
+ ?>
12
+ --FILE--
13
+ <?php
14
+
15
+ register_shutdown_function (function () {
16
+ new stdClass ;
17
+ });
18
+
19
+ $ ary = [];
20
+ while (true ) {
21
+ $ ary [] = new stdClass ;
22
+ }
23
+
24
+ ?>
25
+ --EXPECTF--
26
+ Fatal error: Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes) in %s on line %d
27
+ %A
Original file line number Diff line number Diff line change @@ -116,8 +116,10 @@ ZEND_API void zend_objects_store_put(zend_object *object)
116
116
EG (objects_store ).free_list_head = GET_OBJ_BUCKET_NUMBER (EG (objects_store ).object_buckets [handle ]);
117
117
} else {
118
118
if (EG (objects_store ).top == EG (objects_store ).size ) {
119
- EG (objects_store ).size <<= 1 ;
120
- EG (objects_store ).object_buckets = (zend_object * * ) erealloc (EG (objects_store ).object_buckets , EG (objects_store ).size * sizeof (zend_object * ));
119
+ uint32_t new_size = 2 * EG (objects_store ).size ;
120
+ EG (objects_store ).object_buckets = (zend_object * * ) erealloc (EG (objects_store ).object_buckets , new_size * sizeof (zend_object * ));
121
+ /* Assign size after realloc, in case it fails */
122
+ EG (objects_store ).size = new_size ;
121
123
}
122
124
handle = EG (objects_store ).top ++ ;
123
125
}
You can’t perform that action at this time.
0 commit comments