]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-8.0'
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 20 Oct 2020 10:51:17 +0000 (12:51 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 20 Oct 2020 10:51:17 +0000 (12:51 +0200)
* PHP-8.0:
  Fix bug #79643: Invalid memory read when opcache.interned_strings_buffer is 0

1  2 
ext/opcache/ZendAccelerator.c

index 5ca1baf3707d43c740a1ce40da78ee63b8c315e0,22b484b78942a44b01eb196c741dafc8068215ef..56757895bb8d5596b476d8a60082b872bda67f6d
@@@ -2634,10 -2634,12 +2634,12 @@@ static int zend_accel_init_shm(void
        if (ZCG(accel_directives).interned_strings_buffer) {
                accel_shared_globals = zend_shared_alloc((ZCG(accel_directives).interned_strings_buffer * 1024 * 1024));
        } else {
-               accel_shared_globals = zend_shared_alloc(sizeof(zend_accel_shared_globals));
+               /* Make sure there is always at least one interned string hash slot,
+                * so the table can be queried unconditionally. */
+               accel_shared_globals = zend_shared_alloc(sizeof(zend_accel_shared_globals) + sizeof(uint32_t));
        }
        if (!accel_shared_globals) {
 -              zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
 +              zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
                zend_shared_alloc_unlock();
                return FAILURE;
        }