1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 04:02:19 +02:00

Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fix bug #79643: Invalid memory read when opcache.interned_strings_buffer is 0
This commit is contained in:
Nikita Popov
2020-10-20 12:51:08 +02:00

View File

@@ -2634,7 +2634,9 @@ 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!");
@@ -2675,6 +2677,8 @@ static int zend_accel_init_shm(void)
STRTAB_INVALID_POS,
(char*)ZCSG(interned_strings).start -
((char*)&ZCSG(interned_strings) + sizeof(zend_string_table)));
} else {
*STRTAB_HASH_TO_SLOT(&ZCSG(interned_strings), 0) = STRTAB_INVALID_POS;
}
zend_interned_strings_set_request_storage_handlers(accel_new_interned_string_for_php, accel_init_interned_string_for_php);