PHP :: Bug #42378 :: bind_result memory exhaustion
| Bug #42378 | bind_result memory exhaustion | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2007-08-22 11:33 UTC | Modified: | 2008-03-25 19:09 UTC |
|
||||||||||
| From: | jullrich at sans dot org | Assigned: | andrey (profile) | |||||||||||
| Status: | Wont fix | Package: | MySQLi related | |||||||||||
| PHP Version: | 5.2.3 | OS: | Linux (CentOS 4.5) | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2007-08-22 11:33 UTC] jullrich at sans dot org
Description: ------------ The use of the mysql command "format" will lead to memory exhaustion on bind_results. Here sample code that does cause the issue: $sQuery="select targetport,format(trend,2) from trends where current_targets>10 and trend is not null order by trend desc limit 100"; $oStmt=$oDB->prepare($sQuery); $oStmt->execute(); $oStmt->store_result(); $oStmt->bind_result($nPort,$nTrend); This code works fine if $sQuery is replaced with: $sQuery="select targetport,trend from trends where current_targets>10 and trend is not null order by trend desc limit 100"; removing 'store_result' has no effect. Other changes to the SQL statement have no effect either. Error message logged: PHP Fatal error: Allowed memory size of 83886080 bytes exhausted (tried to allocate 1431655788 bytes) in query.html on line 4 Reproduce code: --------------- $sQuery="select targetport,format(trend,2) from trends where current_targets>10 and trend is not null order by trend desc limit 100"; $oStmt=$oDB->prepare($sQuery); $oStmt->execute(); $oStmt->store_result(); $oStmt->bind_result($nPort,$nTrend); Expected result: ---------------- I expected the query to "happen" and get executed. Actual result: -------------- PHP Fatal error: Allowed memory size of 83886080 bytes exhausted (tried to allocate 1431655788 bytes) in query.html on line 4 (Line number corresponds to the 'bind_result' statement)
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2007-08-22 11:44 UTC] jullrich at sans dot org
[2007-08-23 10:42 UTC] jani@php.net
[2007-09-03 14:52 UTC] uwendel at mysql dot com
[2007-09-03 18:55 UTC] jullrich at sans dot org
[2007-09-04 16:50 UTC] uwendel at mysql dot com
[2007-09-04 18:22 UTC] uwendel at mysql dot com
[2007-09-04 18:53 UTC] jullrich at sans dot org
[2008-03-25 19:09 UTC] andrey@php.net