Bug #13596 Updated: php crash on second accessing of allocated memory

From: Date: Wed, 16 Jan 2002 10:45:57 +0000
Subject: Bug #13596 Updated: php crash on second accessing of allocated memory
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-77225@lists.php.net to get a copy of this message
ID: 13596 User updated by: ozoon@vnet.ee Reported By: ozoon@vnet.ee Status: Closed Bug Type: Semaphore related Operating System: redhat 7.1 PHP Version: 4.0.6 New Comment: yes Previous Comments: ------------------------------------------------------------------------ [2002-01-16 05:45:42] ozoon@vnet.ee yes ------------------------------------------------------------------------ [2002-01-14 02:31:31] lobbin@php.net Does this work on 4.1.1? ------------------------------------------------------------------------ [2001-10-08 11:30:28] ozoon@vnet.ee I got it working, but i had to change C source for it: in ext/shmop/shmop.c -------------------------- if (memchr((*flags)->value.str.val, 'a', (*flags)->value.str.len)) { shmflg = SHM_RDONLY; shmop->shmflg |= IPC_EXCL; } ------------- changed to: ------------- if (memchr((*flags)->value.str.val, 'a', (*flags)->value.str.len)) { shmop->shmflg |= IPC_EXCL; shmop->shmflg |= SHM_R; shmop->shmflg |= SHM_W; } ------------- and it worked.... I hope php 4.0.7 will implement some patch too for it (CVS is still buggy) Thx. O. ------------------------------------------------------------------------ [2001-10-08 07:33:08] ozoon@vnet.ee Hi. Its seems to be impossible to use shmop_write if you are opening memory segment secong time. example code (produces crash): $mid = 0xffe; $shm_id = shmop_open($mid, "c", 0644, 100); if(!$shm_id) { echo "Couldn't create shared memory segment\n"; } $shm_bytes_written = shmop_write($shm_id, "my shared memory block", 0); if($shm_bytes_written != strlen("my shared memory block")) { echo "Couldn't write the entire length of data\n"; } shmop_close($shm_id); $shm_id = shmop_open($mid, "a", 0, 0); $shm_bytes_written = shmop_write($shm_id, "my shared memory block", 0); if($shm_bytes_written != strlen("my shared memory block")) { echo "Couldn't write the entire length of data\n"; } shmop_close($shm_id); I did somehting wrong? or i should use other release of PHP? O. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13596&edit=1

« previous php.dev (#77225) next »