mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix #81407: shmop_open won't attach and causes php to crash
This commit is contained in:
commit
404bed1a69
3 changed files with 29 additions and 3 deletions
3
NEWS
3
NEWS
|
@ -2,6 +2,9 @@ PHP NEWS
|
||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
?? ??? ????, PHP 8.1.0RC2
|
?? ??? ????, PHP 8.1.0RC2
|
||||||
|
|
||||||
|
- Shmop:
|
||||||
|
. Fixed bug #81407 (shmop_open won't attach and causes php to crash). (cmb)
|
||||||
|
|
||||||
- Opcache:
|
- Opcache:
|
||||||
. Fixed bug #81409 (Incorrect JIT code for ADD with a reference to array).
|
. Fixed bug #81409 (Incorrect JIT code for ADD with a reference to array).
|
||||||
(Dmitry)
|
(Dmitry)
|
||||||
|
|
|
@ -609,16 +609,20 @@ TSRM_API int pclose(FILE *stream)
|
||||||
return termstat;
|
return termstat;
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
|
#define SEGMENT_PREFIX "TSRM_SHM_SEGMENT:"
|
||||||
|
#define DESCRIPTOR_PREFIX "TSRM_SHM_DESCRIPTOR:"
|
||||||
|
#define INT_MIN_AS_STRING "-2147483648"
|
||||||
|
|
||||||
TSRM_API int shmget(key_t key, size_t size, int flags)
|
TSRM_API int shmget(key_t key, size_t size, int flags)
|
||||||
{/*{{{*/
|
{/*{{{*/
|
||||||
shm_pair *shm;
|
shm_pair *shm;
|
||||||
char shm_segment[26], shm_info[29];
|
char shm_segment[sizeof(SEGMENT_PREFIX INT_MIN_AS_STRING)], shm_info[sizeof(DESCRIPTOR_PREFIX INT_MIN_AS_STRING)];
|
||||||
HANDLE shm_handle = NULL, info_handle = NULL;
|
HANDLE shm_handle = NULL, info_handle = NULL;
|
||||||
BOOL created = FALSE;
|
BOOL created = FALSE;
|
||||||
|
|
||||||
if (key != IPC_PRIVATE) {
|
if (key != IPC_PRIVATE) {
|
||||||
snprintf(shm_segment, sizeof(shm_segment), "TSRM_SHM_SEGMENT:%d", key);
|
snprintf(shm_segment, sizeof(shm_segment), SEGMENT_PREFIX "%d", key);
|
||||||
snprintf(shm_info, sizeof(shm_info), "TSRM_SHM_DESCRIPTOR:%d", key);
|
snprintf(shm_info, sizeof(shm_info), DESCRIPTOR_PREFIX "%d", key);
|
||||||
|
|
||||||
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
|
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
|
||||||
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
|
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
|
||||||
|
|
19
ext/shmop/tests/bug81407.phpt
Normal file
19
ext/shmop/tests/bug81407.phpt
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #81407 (shmop_open won't attach and causes php to crash)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (PHP_OS_FAMILY !== "Windows") die("skip for Windows only");
|
||||||
|
if (!extension_loaded("shmop")) die("skip shmop extension not available");
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$a = shmop_open(367504384, 'n', 0664, 262144);
|
||||||
|
$b = shmop_open(367504385, 'n', 0664, 65536);
|
||||||
|
if ($b == false) {
|
||||||
|
$b = shmop_open(367504385, 'w', 0664, 65536);
|
||||||
|
}
|
||||||
|
var_dump($a !== false, $b !== false);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
bool(true)
|
||||||
|
bool(true)
|
Loading…
Add table
Add a link
Reference in a new issue