php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59748 Causes segfault with non ascii chars is used in paths
Submitted: 2011-05-04 18:23 UTC Modified: 2011-10-05 21:29 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: stamp at stamp dot se Assigned:
Status: No Feedback Package: svn (PECL)
PHP Version: 5.3.2 OS: Ubuntu server 10.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: stamp at stamp dot se
New email:
PHP Version: OS:

 

 [2011-05-04 18:23 UTC] stamp at stamp dot se
Description:
------------
From aptitude show php5-svn:
Package: php5-svn
Version: 1.0.0-1
Section: devel
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Depends: libapr1 (>= 1.2.7), libc6 (>= 2.4), libsvn1 (>= 1.6), phpapi-20090626+lfs, ucf

I have a simple php script that fetches the content of a file in the svn repository. Everything works fine with ascii chars but when there is a file with none ascii chars the apache process segfaults.

Php5 is installed with standard config. Mysql, gd, cli, xcache, xmlrpc, snmp, mcrypt and curl are the modules installed.

Reproduce code:
---------------
cat ../../svn.php
<?php

$_GET['path'] = trim(ltrim($_GET['path'],'/'));
if ($repo = svn_repos_open('/var/svn/wsj'))
if ($repo_fs = svn_repos_fs($repo))
if ($head = svn_fs_youngest_rev($repo_fs))
if ($repo_fs_root = svn_fs_revision_root($repo_fs,$head)) {

    header('Content-Type: '.svn_fs_node_prop($repo_fs_root,$_GET['path'],'svn:mime-type'));
    header('Content-Length: '.svn_fs_file_length($repo_fs_root,$_GET['path']));
    $f = svn_fs_file_contents($repo_fs_root,$_GET['path']);

    echo stream_get_contents($f);

}
?>

svn.php?path=pdfFiles/145_Duschtalt_44_A.pdf <-- DO work
svn.php?path=pdfFiles/145_Duscht?lt_44_A.pdf <-- Causes segfault

Expected result:
----------------
The content of the requested file

Actual result:
--------------
Blank page

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-04 21:46 UTC] alan at akbkhome dot com
can you confirm which one (or if it's all of these cause the 
segfault)

svn_fs_node_prop
svn_fs_file_length
svn_fs_file_contents

Thanks
 [2011-05-05 01:34 UTC] stamp at stamp dot se
I can confirm the problem with the following functions:

svn_fs_file_contents
svn_fs_file_length
svn_fs_is_dir
svn_fs_is_file
svn_fs_node_created_rev
svn_fs_node_prop
 [2011-05-05 01:42 UTC] alan at akbkhome dot com
Ok, just checked the code for this.

In the development version it does this 
svn_utf_cstring_to_utf8 (&utf8_path, path, subpool);
path = svn_path_canonicalize(utf8_path, subpool);

Which is supposed to sort these types of values out.

Can you try a few things.
a) test the version in svn.
svn co http://svn.php.net/repository/pecl/svn/trunk svn
cd svn
phpize
./configure
make install

you will need the php5-dev package to build this.

b) test with a cli script and run with gdb
gdb php5
> run mytest.php
... segfault...
> bt full
... paste result into the bug report

Regards
Alan
 [2011-05-06 03:58 UTC] stamp at stamp dot se
a) I tried to run ./configure but it stoped at :

....
checking for svn support... yes, shared
checking for specifying the location of apr for svn... yes, 
shared
checking for svn includes... configure: error: failed to 
find svn_client.h

I suppose I need a source version of subversion?

b) When i run the script thru php5-cli instead everything 
works just fine?!

:/var/www# php svn.php <-- WORKS
http://dev.jsite.se/svn.php <-- Causes "[Fri May 06 09:50:39 
2011] [notice] child pid 3744 exit signal Segmentation fault 
(11)" in the apache error log.

Server version: Apache/2.2.14 (Ubuntu)
Server built:   Nov 18 2010 21:17:19

If I removes the lines with svn_fs_node_prop, 
svn_fs_file_length and svn_fs_file_contents in the script, 
then apache stops to segfault.
 [2011-05-08 10:34 UTC] alan at akbkhome dot com
yes, you need the development packages,

try

sudo apt-get build-dep php-svn
 [2011-05-23 08:43 UTC] jonas dot falck at gmail dot com
I've now built it and still the same problem. 

compiled this version from : 
svn client version 	1.6.12
svn extension version 	1.0.2-dev 
Revision: 311349

Its still segfaulting when ran through apache2. 
php cli works. 


[Mon May 23 14:35:44 2011] [notice] child pid 18826 exit signal Segmentation fault (11)


We did those test on a fresh installer virtual machine running ubuntu server 11.04 with the following php script:

<?php
error_reporting(E_ALL);
ini_set('display_errors',true);
if (is_dir('/var/svn/test') && $repo = svn_repos_open('/var/svn/test'))
    if ($repo_fs = svn_repos_fs($repo))
	if ($head = svn_fs_youngest_rev($repo_fs))
	    if ($repo_fs_root = svn_fs_revision_root($repo_fs,$head)) {

			$data = svn_fs_dir_entries($repo_fs_root,'./');
			print_r($data);
			foreach($data as $file=> $line){
				$rev = svn_fs_node_created_rev($repo_fs_root,'/'.$file);
				echo $rev;
			}

		}




echo "hej";

?>
 [2011-05-31 22:35 UTC] alan at akbkhome dot com
I should have given you this originally.
http://bugs.php.net/bugs-generating-backtrace.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC