php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35617 stristr() always segfaults
Submitted: 2005-12-09 23:13 UTC Modified: 2005-12-09 23:27 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kennyt@php.net Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 6CVS-2005-12-09 (CVS) OS: Linux 2.6.14
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kennyt@php.net
New email:
PHP Version: OS:

 

 [2005-12-09 23:13 UTC] kennyt@php.net
Description:
------------
Current CVS' stristr() seems to segfault whenever used...

Reproduce code:
---------------
<?php
$a = 'sdfsf';
$b = 'sdf';

echo stristr($a, $b);
echo stristr($b, $a);
?>

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.

[Switching to Thread -1227483472 (LWP 5822)]

0x0835dd6d in _estrndup (s=0x0, length=1836345391, 

    __zend_filename=0x858b688 "/root/php-src/ext/standard/string.c", 

    __zend_lineno=2127, __zend_orig_filename=0x0, __zend_orig_lineno=0)

    at /root/php-src/Zend/zend_alloc.c:443

443	/root/php-src/Zend/zend_alloc.c: No such file or directory.

	in /root/php-src/Zend/zend_alloc.c

(gdb) bt

#0  0x0835dd6d in _estrndup (s=0x0, length=1836345391, 

    __zend_filename=0x858b688 "/root/php-src/ext/standard/string.c", 

    __zend_lineno=2127, __zend_orig_filename=0x0, __zend_orig_lineno=0)

    at /root/php-src/Zend/zend_alloc.c:443

#1  0x082c8fd3 in zif_stristr (ht=2, return_value=0x8846d64, 

    return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)

    at /root/php-src/ext/standard/string.c:2127

#2  0x083aebad in zend_do_fcall_common_helper_SPEC (execute_data=0xbfc3a7f4)

    at zend_vm_execute.h:201

#3  0x083b4e20 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xbfc3a7f4)

    at zend_vm_execute.h:1536

#4  0x083ae750 in execute (op_array=0x88424fc) at zend_vm_execute.h:92

#5  0x083822b4 in zend_execute_scripts (type=8, retval=0x0, file_count=3)

    at /root/php-src/Zend/zend.c:1805

#6  0x0832469c in php_execute_script (primary_file=0xbfc3cbec)

    at /root/php-src/main/main.c:1850

#7  0x084090c8 in main (argc=3, argv=0xbfc3cd14)

    at /root/php-src/sapi/cli/php_cli.c:1072

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-09 23:27 UTC] tony2001@php.net
This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 22:00:02 2026 UTC