mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
The constant name is usually interend. Without opcache, compilation always interns strings. Without opcache, compilation does not intern (new) strings, but persisting of script does. If a script is not stored in shm the constant name will not be interned. The building of enum backing stores was missing a addref for the constant name, leading to a double-free when releasing constants and backing stores of enums. Fixes GH-12366 Closes GH-12405
17 lines
393 B
PHP
17 lines
393 B
PHP
--TEST--
|
|
GH-12366: Use-after-free of constant name when script doesn't fit in SHM
|
|
--EXTENSIONS--
|
|
opcache
|
|
--INI--
|
|
opcache.enable_cli=1
|
|
opcache.file_update_protection=1
|
|
--FILE--
|
|
<?php
|
|
$file = __DIR__ . '/gh12366.inc';
|
|
// Update timestamp and use opcache.file_update_protection=1 to prevent included file from being persisted in shm.
|
|
touch($file);
|
|
require $file;
|
|
?>
|
|
--EXPECT--
|
|
enum(Level::Debug)
|