|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #590 File Upload Seg Fault
Submitted: 1998-07-28 13:18 UTC Modified: 1998-09-12 18:44 UTC
From: jwalsh at verio dot net Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 3.0.2a OS: Solaris 2.5x
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: jwalsh at verio dot net
New email:
PHP Version: OS:


 [1998-07-28 13:18 UTC] jwalsh at verio dot net
Configuration: See

Problem: As soon as the "Import Passwords" button is clicked, I get a "Document Contains no Data" and the following error in the error_log.

     [Tue Jul 28 10:02:02 1998] [notice] httpd: child pid 10902 exit signal Segmentation Fault (11)

This worked fine with PHP 3.0, but not with 3.0.1 either.

Code Chunk:

function MyErr() {
	print ("
<head><title>CCAPTA: Error!</title></head>
<body bgcolor=\"#9eb8df\">
<p align=\"center\"><img src=\"\"
WIDTH=\"551\" HEIGHT=\"103\"></p>
<table border=\"0\" width=\"550\" cellspacing=\"0\" align=\"center\"> 
    <td bgcolor=\"#808080\" align=\"center\"><font
    <td>File not uploaded correctly</td>

if( $mode == "update" ) {
	if( $file == "none" ) {
	} else {
    	echo "<p align=\"center\">Conversion In Progress . . .<BR>\n";
    	/* echo "Original file name: $upfile_name<BR>\n"; 
    	echo "File in upload_tmp_dir: $upfile<BR>\n"; 
    	echo "File size: $upfile_size<BR>\n"; 
    	echo "File type: $upfile_type<BR>\n"; */
		echo "This operation may take up to 2 minutes.<BR>\n";

		$htpasswd = "/home/virtual/Rabbits/members/.htpasswd";
		exec( "cp $upfile /home/virtual/Rabbits/admin/." );
		$fp = fopen( $upfile, "r+" );
		$original = fread( $fp, filesize( $upfile ) );
		$new = ereg_replace( "\r", "\n", $original );
		fwrite( $fp, $new, filesize( $upfile ) );
		fclose( $fp );
		$rawfile = @file( $upfile );
		$fp = fopen( $htpasswd, "w" );

		for( $i = 0; $i <= count( $rawfile ); $i++ ) {
			$rawline = $rawfile[$i];
			$rawline = explode( ",", ereg_replace( "\"", "", $rawline ) );
			$newline = $rawline[0].":".crypt( $rawline[1], substr( $rawline[1], 1, 2 ) )."\n";
			fputs( $fp, $newline);

		fclose( $fp );
		exec( "rm $upfile" );
	echo "Password file conversion complete.</p>\n";
} else {
	echo "Normal<BR>\n";
<title>CCAPTA Password Admin</title>

<body bgcolor="#9eb8df">

<p align="center"><img src="" WIDTH="551"
<div align="center"><center>

<table border="0" width="550" cellspacing="0">
    <td bgcolor="#808080" align="center"><font size="4"><strong>Web Password
    <td>Please click on &quot;Browse&quot; button to
    select which file you would like to upload and click the
    &quot;Import Passwords&quot; button to update the protected site
    access list. The file used to update the password list must be
    saved as a comma delimited, quote encapsulated ASCII file.&nbsp;
    The file name you use to update the list can be whatever you want
    it to be <b>but the file name cannot include special characters
    such as &amp;, $, !, #, @, %, *, or ^.</b>
    <form enctype="multipart/form-data" action="<? echo $PHP_SELF ?>" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="200000">
	<input type="hidden" name="mode" value="update">
    <p>File to Upload: <input type="file" name="upfile" size="40"
    <div align="center"><input type="submit" value="Import Passwords"></div>
    <td align="center"><font size="2"><br>
    Please report any problems with this web application to <a


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-09-12 18:44 UTC] zeev
Any chance you could run your server under gdb and get us a backtrace of this seg fault?


This doesn't look like a file upload problem to me, it
probably crashes in the code that processes the uploaded
file and not during the file upload itself.

My guess is that you've compiled/linked the regex
libraries badly.  See the FAQ for additional

To check if this is indeed the case, comment out
the regular expression calls (all ereg*() functions) and
see if it still crashes.  If it doesn't, it means that
you have a regex messup that you need to fix.
If it still does, please try to remove get the smallest
script snippet that still reproduces the problem, and
submit a new bug report.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Nov 28 16:05:51 2022 UTC