php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64808 FreeTDS PDO getColumnMeta on a prepared but not executed statement crashes
Submitted: 2013-05-10 06:01 UTC Modified: 2013-06-04 00:25 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: chris dot kings-lynne at navitas dot com Assigned: ssufficool
Status: Closed Package: PDO related
PHP Version: 5.4.15 OS: Debian
Private report: No CVE-ID:
 [2013-05-10 06:01 UTC] chris dot kings-lynne at navitas dot com
Description:
------------
If you attempt to use getColumnMeta() on a prepared but not yet executed 
PDOStatement, using the dblib driver, you get a segmentation fault.

FreeTDS library version 0.82-7

Test script:
---------------
<?php

$pdo = new PDO('dblib:host=SERVICE;dbname=xxx','xxx','xxx');

$result = $pdo->prepare('SELECT * FROM users');
$meta = $result->getColumnMeta(1);


Expected result:
----------------
I would expect to get the column metadata just as it as after execution, as in 
this code sample:

<?php

$pdo = new PDO('dblib:host=SERVICE;dbname=xxx','xxx','xxx');

$result = $pdo->prepare('SELECT * FROM users');
$result->execute();
$meta = $result->getColumnMeta(1);
var_dump($meta);

Gives:

array(8) {
  'max_length' =>
  int(8)
  'precision' =>
  int(0)
  'scale' =>
  int(0)
  'column_source' =>
  string(4) "mode"
  'native_type' =>
  string(7) "unknown"
  'name' =>
  string(4) "mode"
  'len' =>
  int(8)
  'pdo_type' =>
  int(2)
}


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

Don't have debugging symbols or gdb on the machine sorry :(

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-10 06:13 UTC] chris dot kings-lynne at navitas dot com
Not that useful without debug symbols, but at least shows the crash is in dblib:

(gdb) bt
#0  0x00007fffeb0817e6 in ?? () from /usr/lib/php5/20100525/pdo_dblib.so
#1  0x00007ffff3e5de15 in ?? () from /usr/lib/php5/20100525/pdo.so
#2  0x00007ffff407906b in xdebug_execute_internal () from 
/usr/lib/php5/20100525/xdebug.so
#3  0x0000000000746e18 in ?? ()
#4  0x0000000000734438 in execute ()
#5  0x00007ffff4079449 in xdebug_execute () from 
/usr/lib/php5/20100525/xdebug.so
#6  0x00000000006c9630 in zend_execute_scripts ()
#7  0x000000000066bba8 in php_execute_script ()
#8  0x0000000000776553 in ?? ()
#9  0x0000000000776d18 in ?? ()
#10 0x00007ffff4a52c8d in __libc_start_main () from /lib/libc.so.6
#11 0x0000000000430359 in _start ()
 [2013-05-31 21:38 UTC] ssufficool@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: ssufficool
 [2013-06-01 05:58 UTC] ssufficool@php.net
Automatic comment on behalf of ssufficool
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0e2bcf3373d914a215784c041a2a4c3b6afc2034
Log: FIX BUG #64338, #64808, #63638
 [2013-06-01 05:59 UTC] ssufficool@php.net
-Status: Assigned +Status: Closed
 [2013-06-01 05:59 UTC] ssufficool@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2013-06-04 00:25 UTC] chris dot kings-lynne at navitas dot com
That's awesome, any chance it can be pushed to the next 5.4 release pretty please? 
:)
 [2013-06-04 03:40 UTC] ssufficool@php.net
Automatic comment on behalf of ssufficool
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d8f938c78478c211dc3b5609e9f37d2e2c47896f
Log: FIX BUG #55647, #60512, #60512, #61900, #64338, #64808, #63638
 [2013-06-04 05:03 UTC] stas@php.net
Automatic comment on behalf of ssufficool
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d8f938c78478c211dc3b5609e9f37d2e2c47896f
Log: FIX BUG #55647, #60512, #60512, #61900, #64338, #64808, #63638
 [2013-11-17 09:31 UTC] laruence@php.net
Automatic comment on behalf of ssufficool
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d8f938c78478c211dc3b5609e9f37d2e2c47896f
Log: FIX BUG #55647, #60512, #60512, #61900, #64338, #64808, #63638
 [2013-11-17 09:31 UTC] laruence@php.net
Automatic comment on behalf of ssufficool
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0e2bcf3373d914a215784c041a2a4c3b6afc2034
Log: FIX BUG #64338, #64808, #63638
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 05:03:21 2014 UTC