php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17785 Unions by reference result in compile failure
Submitted: 2002-06-16 10:26 UTC Modified: 2002-11-23 09:13 UTC
From: msopacua at idg dot nl Assigned: msopacua (profile)
Status: Closed Package: Semaphore related
PHP Version: 4.0CVS-2002-06-16 OS: BSD/OS 4.2
Private report: No CVE-ID: None
 [2002-06-16 10:26 UTC] msopacua at idg dot nl
/chroot/home/mdev/php4-200206160300/ext/sysvsem/sysvsem.c: In function `zif_sem_remove':
/chroot/home/mdev/php4-200206160300/ext/sysvsem/sysvsem.c:382: incompatible type for argument 4 of `semctl'
/chroot/home/mdev/php4-200206160300/ext/sysvsem/sysvsem.c:391: incompatible type for argument 4 of `semctl'


The fix seems to be to replace &un by un in the corresponding lines.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-13 18:21 UTC] derick@php.net
Assinging to Melvyn
 [2002-07-22 14:55 UTC] msopacua at idg dot nl
Thanx Derick :-) 
 
The problem seems to be more than a compiling issue only. 
On FreeBSD (tested on 4.5 and 4.6) this compiles ok, but 
than segfaults on it. The problem is however with the 
sysvsem_sem struct: 
Program received signal SIGSEGV, Segmentation fault. 
0x813bdef in zif_sem_remove (ht=0, 
return_value=0x3d3c4f16, this_ptr=0x0, 
return_value_used=0) at 
/home/mdev/cvs/php4/ext/sysvsem/sysvsem.c:391 
391             if(semctl(sem_ptr->semid, 0, IPC_RMID, 
&un) < 0) { 
(gdb) bt 
#0  0x813bdef in zif_sem_remove (ht=0, 
return_value=0x3d3c4f16, this_ptr=0x0, 
return_value_used=0) at 
/home/mdev/cvs/php4/ext/sysvsem/sysvsem.c:391 
#1  0x0 in ?? () 
(gdb) print un 
$1 = {val = 656363, buf = 0xa03eb, array = 0xa03eb} 
(gdb) print &un 
$2 = (union semun *) 0xbfbfbdbc 
(gdb) print sem_ptr 
$3 = (sysvsem_sem *) 0xa03eb 
(gdb) print sem_ptr->semid 
Error accessing memory address 0xa03f3: Bad address. 
 
I noticed that the union for FreeBSD is also different, 
than the one declared in sysvsem.c - especially the 
seminfo *__buf pointer is missing. So this may require 
some more attention, than just a compile fix.
 [2002-11-23 09:13 UTC] msopacua@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC