php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23388 fopen with empty parameters and timeout of 1 causes segfault
Submitted: 2003-04-28 13:21 UTC Modified: 2003-05-21 20:13 UTC
From: justmanj at msu dot edu Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.3.0 OS: os x 10.2.5
Private report: No CVE-ID: None
 [2003-04-28 13:21 UTC] justmanj at msu dot edu
reproduceable segmentation fault on osx 10.2.5 when the following code is executed and attempting to connect to a host with a closed port:

if($fp = fsockopen($host, $port, $errno, $errstr, 1))

please note, this is without initilizing $errno and $errstr.

connecting to a valid host will not result in any problems, but attepting to connect to an invalid host/port will cause php to segfault at the termination of the script

Upon adding a $errno = "" and $errstr = "" before the fsockopen call, this problem is alleviated.

Backtrace:

Date/Time:  2003-04-28 14:18:06 -0400
OS Version: 10.2.5 (Build 6L29)
Host:       ellison

Command:    php
PID:        5701

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x00520000

Thread 0 Crashed:
 #0   0x000bd53c in shutdown_memory_manager (zend_alloc.c:461)
 #1   0x000a2e60 in php_request_shutdown (main.c:950)
 #2   0x000e0e68 in main (php_cli.c:805)
 #3   0x00001f94 in _start (crt.c:267)
 #4   0x00001e14 in start

PPC Thread State:
  srr0: 0x000bd53c srr1: 0x0200f030                vrsave: 0x00000000
   xer: 0x00000000   lr: 0x000bd558  ctr: 0x90003dc0   mq: 0x00000000
    r0: 0x00000000   r1: 0xbfffe310   r2: 0x00000000   r3: 0x00488390
    r4: 0x00487310   r5: 0x00000009   r6: 0x00118bf0   r7: 0x00000000
    r8: 0x00422010   r9: 0x00520000  r10: 0x00422290  r11: 0x0011a470
   r12: 0x90003dc0  r13: 0x00000000  r14: 0x00000000  r15: 0x00000000
   r16: 0x00000000  r17: 0x00000000  r18: 0x00000000  r19: 0x00000000
   r20: 0x00000000  r21: 0x00000000  r22: 0x00000000  r23: 0x00000000
   r24: 0x00000000  r25: 0x00000003  r26: 0x0011d4d4  r27: 0x0011d080
   r28: 0x0000000c  r29: 0x00000001  r30: 0x00000c04  r31: 0x000bd4d4


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-28 15:51 UTC] wez@php.net
Duplicate of #21529.
Already fixed in CVS; please try a stable snapshot from http://snaps.php.net
 [2003-05-21 20:13 UTC] sniper@php.net
Fixed -> closed.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC