php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28511 MySQL seg faults through PHP
Submitted: 2004-05-24 22:11 UTC Modified: 2004-05-27 17:25 UTC
From: tim at timcrider dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.0.0RC2 OS: Fedora Core 2
Private report: No CVE-ID: None
 [2004-05-24 22:11 UTC] tim at timcrider dot com
Description:
------------
If mysql_select_db() fails to select a DB, either the DB is gone or it has been renamed, and you try to run a LOAD DATA INFILE using PHP 5.0.0 RC2, it will seg fault and crash MySQL.

PHP continues to run fine, but MySQL crashes. Also, when trying to do this task inside of the mysql monitor and typing in the command with no database selected, it gives the standard:

ERROR 1046: No Database Selected

 I have been able to reproduce this using MySQL 4.1.1 and MySQL 4.0.20. After installing both versions, I recompiled php to use those specific libararies.

Reproduce code:
---------------
mysql_query("LOAD DATA LOCAL INFILE '/usr/local/data_processor/.working/30953/ALL_SORTED.30953' INTO TABLE `tDWD31HTva`");

Expected result:
----------------
a mysql error, that does not seg fault MySQL.

Actual result:
--------------
MySQL Seg faults, no php error is produced, and MySQL doesn't log the crash as an error.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-27 09:01 UTC] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2004-05-27 17:20 UTC] tim at timcrider dot com
PHP itself doesn't seg fault, it causes MySQL to seg fault.
Do you need an strace of MySQL as well as PHP? The PHP file does not seg fault at all. It is MySQL seg faulting.

 The reason I believe this is a PHP issue, is that if I try to run the same query from the mysql monitor it works in both 4.0.20 and 4.1.1. However when I run that query from php 5.0.0RC2, with the wrong DB selected, it crashes MySQL, but the PHP script goes on just fine, all of the queries just fail.

 I hope this helps, if you have any other questions please let me know.

 Tim
 [2004-05-27 17:25 UTC] gschlossnagle@php.net
If MySQL segfaults, it's MySQLs problem and you should 
submit a bug to them.  Since PHP and MySQL dont' share 
the same address space, there's nothing that PHP can do 
that can crash MySQL and have it be PHP's 'fault'.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 18:01:32 2024 UTC