From: jullrich at sans dot org Operating system: Linux (CentOS 4.5) PHP version: 5.2.3 PHP Bug Type: MySQLi related Bug description: bind_result memory exhaustion
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) -- Edit bug report at http://bugs.php.net/?id=42378&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42378&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42378&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42378&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42378&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42378&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42378&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42378&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42378&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42378&r=support Expected behavior: http://bugs.php.net/fix.php?id=42378&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42378&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42378&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42378&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42378&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42378&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42378&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42378&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42378&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42378&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42378&r=mysqlcfg