php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10235 Segfault on domxml_root()
Submitted: 2001-04-08 16:49 UTC Modified: 2001-07-16 07:30 UTC
From: ih at fido dot cz Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.0 Latest CVS (08/04/2001) OS: Debian Linux 2.2 i386
Private report: No CVE-ID: None
 [2001-04-08 16:49 UTC] ih at fido dot cz
<?
$file1 = "/tmp/file1";
$file2 = "/tmp/file2";

$doc = xmldocfile($file1);

$root = domxml_root($doc);
print_r($root);
?>

./configure --prefix=/usr --with-apxs=/usr/bin/apxs --with-config-file-path=/etc/php4/apache --enable-debug --with-dom

php.ini-dist (not relevant)

Program received signal SIGSEGV, Segmentation fault.
0x403ada4e in compile_branch (options=0, brackets=0x8, codeptr=0x0,
    ptrptr=0x403b1824, errorptr=0x4046baf4, optchanged=0x2, reqchar=0x2,
    countlits=0x2, cd=0x10) at pcre.c:1209
1209                for (c = 0; c < 32; c++) class[c] |= ~cbits[c+cbit_word];
(gdb) bt
#0  0x403ada4e in compile_branch (options=0, brackets=0x8, codeptr=0x0,
    ptrptr=0x403b1824, errorptr=0x4046baf4, optchanged=0x2, reqchar=0x2,
    countlits=0x2, cd=0x10) at pcre.c:1209
#1  0x4046baf4 in inflate_mask () from /usr/lib/libxml2.so.2
#2  0x403b1846 in match (eptr=0x1 <Address 0x1 out of bounds>,
    ecode=0x8155afc "", offset_top=0, md=0x1, ims=135616424, eptrb=0x0,
    flags=1078193993) at pcre.c:3956
#3  0x40375147 in php_if_apache_lookup_uri (ht=135598500, return_value=0x2,
    this_ptr=0x6e616d6d, return_value_used=1077437309) at php_apache.c:407
#4  0x40386420 in php_xpath_get_object (wrapper=0x8, rsrc_type1=3,
    rsrc_type2=0) at php_domxml.c:332
#5  0x4039e4c3 in fn_ext (
    name=0xbffffaf8 "\002f\023\b\024c\023\b\f/\016\b\020\022\025\b")
    at mf_fn_ext.c:24
#6  0x40399b9e in vio_blocking (vio=0x81347ec, set_blocking_mode=8 '\b')
    at violite.c:216
#7  0x4039a8ab in atoi_octal (str=0x81347ec "?G\023\b\224\236\024\b??\f\b")
    at my_init.c:40
#8  0x4039a8ef in atoi_octal (str=0x81347ec "?G\023\b\224\236\024\b??\f\b")
    at my_init.c:42
#9  0x8053ef4 in ap_invoke_handler ()
#10 0x806283c in ap_some_auth_required ()
#11 0x8062898 in ap_process_request ()
#12 0x805c5b9 in ap_child_terminate ()
#13 0x805c74c in ap_child_terminate ()
#14 0x805c869 in ap_child_terminate ()
#15 0x805cd1b in ap_child_terminate ()
#16 0x805d3dd in main ()
#17 0x400c2a42 in __libc_start_main () from /lib/libc.so.6

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-10 10:04 UTC] ih at fido dot cz
./configure --prefix=/usr --with-cgi
-with-config-file-path=./ --enable-debug --disable-xml
--disable-mysql --with-dom --without-mysql --without-pcre-regex

---
./php -m
Running PHP 4.0.6-dev
Zend Engine v1.0.5, Copyright (c) 1998-2001 Zend Technologies

[PHP Modules]
standard
session
posix
domxml

[Zend Modules]

---
[testdomxml.php]
<?

$xmlfile = "./file.xml";

$fp = fopen($xmlfile, "r");
while (!feof($fp)) 
  $buf .= fgets($fp, 127);
  
$doc = xmldocfile($xmlfile);

print_r($doc);

$root = $doc.domxml_root();
print_r($root);
?>
---
gdb php
GNU gdb 19990928

(gdb) set args ../testdomxml.php
(gdb) r
Starting program: /var/local/home/huld/PHP4/CVS/php4/php
../testdomxml.php
X-Powered-By: PHP/4.0.6-dev
Content-type: text/html

<hr>

DomDocument Object
(
    [doc] => Resource id #2
    [url] => ./file.xml
    [version] => 1.0
    [standalone] => -1
    [type] => 9
    [compression] => -1
    [charset] => 1
)

Program received signal SIGSEGV, Segmentation fault.
0x80635ad in php_dom_get_object (wrapper=0x0, rsrc_type1=5,
rsrc_type2=0)
    at php_domxml.c:490
490
	if (Z_TYPE_P(wrapper) != IS_OBJECT) {(gdb) bt
#0  0x80635ad in php_dom_get_object (wrapper=0x0,
rsrc_type1=5, rsrc_type2=0)
    at php_domxml.c:490
#1  0x8066c1c in php_if_domxml_doc_document_element (ht=0, 
    return_value=0x8174ba4, this_ptr=0x0, return_value_used=1)
    at php_domxml.c:1758
#2  0x80f088a in execute (op_array=0x816ff04) at
./zend_execute.c:1494
#3  0x80c7e44 in zend_execute_scripts (type=8, file_count=3)
at zend.c:743
#4  0x805d6cf in php_execute_script
(primary_file=0xbffffca4) at main.c:1196
#5  0x805b6bc in main (argc=2, argv=0xbffffd34) at
cgi_main.c:731


Look's like new Zend API? Other ext/ works excellent.
 [2001-07-16 07:30 UTC] joey@php.net
Fixed in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC