File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -444,7 +444,7 @@ ZEND_API zend_coroutine_event_callback_t * zend_async_coroutine_callback_new(
444444
445445static zend_always_inline zend_async_waker_trigger_t * waker_trigger_create (zend_async_event_t * event , uint32_t initial_capacity )
446446{
447- size_t total_size = sizeof (zend_async_waker_trigger_t ) + initial_capacity * sizeof (zend_async_event_callback_t * );
447+ size_t total_size = sizeof (zend_async_waker_trigger_t ) + ( initial_capacity - 1 ) * sizeof (zend_async_event_callback_t * );
448448 zend_async_waker_trigger_t * trigger = (zend_async_waker_trigger_t * )emalloc (total_size );
449449
450450 trigger -> length = 0 ;
@@ -458,7 +458,7 @@ static zend_always_inline zend_async_waker_trigger_t *waker_trigger_add_callback
458458{
459459 if (trigger -> length >= trigger -> capacity ) {
460460 uint32_t new_capacity = trigger -> capacity * 2 ;
461- size_t total_size = sizeof (zend_async_waker_trigger_t ) + new_capacity * sizeof (zend_async_event_callback_t * );
461+ size_t total_size = sizeof (zend_async_waker_trigger_t ) + ( new_capacity - 1 ) * sizeof (zend_async_event_callback_t * );
462462
463463 zend_async_waker_trigger_t * new_trigger = (zend_async_waker_trigger_t * )erealloc (trigger , total_size );
464464 new_trigger -> capacity = new_capacity ;
Original file line number Diff line number Diff line change @@ -421,7 +421,7 @@ struct _zend_async_waker_trigger_s {
421421 uint32_t length ; /* current number of callbacks */
422422 uint32_t capacity ; /* allocated slots in the array */
423423 zend_async_event_t * event ;
424- zend_async_event_callback_t * data []; /* flexible array member */
424+ zend_async_event_callback_t * data [1 ]; /* flexible array member */
425425};
426426
427427/* Dynamic array of async event callbacks with single iterator protection */
You can’t perform that action at this time.
0 commit comments