From:             
Operating system: CentOS 5.5
PHP version:      5.2.14
Package:          PDO related
Bug Type:         Bug
Bug description:pdo_dblib segmentation fault when iterating MONEY values

Description:
------------
Fix for bug 51213 released into 5.2.14 and 5.3.3 causes segmentation fault
when an SQL query attempts to read MSSQL MONEY type columns, or aggregates
of those column types.



Problem appears to be invalid val->data pointer passed to spprintf() call
at line 174 of dblib_stmt.c



Oddly, the patch attached to bug 51213 works properly, but is not the same
as what was comitted to the code base.



In the patch attached to 51213, val->data is properly emalloc'd some memory
before any sprintf()-type of operation is performed.

Test script:
---------------
// On a table containing a MONEY (field named "amount");



$sql = "SELECT SUM(amount) FROM table";

$rs = $pdo->query($sql, PDO::FETCH_OBJ);

foreach($rs as $row) {

   var_dump($row);

}

Expected result:
----------------
Expected to see rows dumped from table.

Actual result:
--------------
Segmentation fault.

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52546&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52546&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52546&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52546&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52546&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52546&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52546&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52546&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52546&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52546&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52546&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52546&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52546&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52546&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52546&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52546&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52546&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52546&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52546&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52546&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52546&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52546&r=mysqlcfg

Reply via email to