Bug #69757 [NEW]: Segmentation fault on nextRowset
From: miracle at rpz dot name
Operating system: Linux
PHP version: 5.6.9
Package: PDO DBlib
Bug Type: Bug
Bug description:Segmentation fault on nextRowset
Description:
------------
php configured --with-pdo-dblib=shared,/usr
After fetch first (any) resultset PDOStatement::nextRowset() cause
segmentation fault instead of return boolean result.
Segfault reproduced with php 5.4.41, 5.5.25, 5.6.9; freetds: 0.91,
0.95rc3
Test script:
---------------
<?php
if (!extension_loaded('pdo_dblib')) {
die('skip not loaded');
}
require __DIR__ . '/config.inc';
$sql = "
EXEC sp_executesql N'
SELECT 1 as first_rowset
SELECT 2 as second_rowset
'
";
//$sql = 'SELECT 1 as first_rowset'; // same result: segfault
$stmt = $db->query($sql);
$resultset1 = $stmt->fetchAll(PDO::FETCH_ASSOC);
//var_dump($resultset1); // first_rowset => 1
$stmt->nextRowset(); //segfault here
Actual result:
--------------
Core was generated by `php pdo_dblib_next_rowset_segfault.php'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000000000067c6d8 in zend_mm_check_ptr (heap=0x1493b20,
ptr=0x16f2308, silent=1,
__zend_filename=0x7f1e5d148c08 "/tmp/php-5.6.9/ext/pdo/pdo_stmt.c",
__zend_lineno=2053, __zend_orig_filename=0x0,
__zend_orig_lineno=0) at /tmp/php-5.6.9/Zend/zend_alloc.c:1384
1384 if (p->info._size != ZEND_MM_NEXT_BLOCK(p)->info._prev)
{
(gdb) bt
#0 0x000000000067c6d8 in zend_mm_check_ptr (heap=0x1493b20,
ptr=0x16f2308, silent=1,
__zend_filename=0x7f1e5d148c08 "/tmp/php-5.6.9/ext/pdo/pdo_stmt.c",
__zend_lineno=2053, __zend_orig_filename=0x0,
__zend_orig_lineno=0) at /tmp/php-5.6.9/Zend/zend_alloc.c:1384
#1 0x000000000067e2d2 in _zend_mm_free_int (heap=0x1493b20,
p=0x16f2308,
__zend_filename=0x7f1e5d148c08 "/tmp/php-5.6.9/ext/pdo/pdo_stmt.c",
__zend_lineno=2053, __zend_orig_filename=0x0,
__zend_orig_lineno=0) at /tmp/php-5.6.9/Zend/zend_alloc.c:2068
#2 0x000000000067f75c in _efree (ptr=0x16f2308,
__zend_filename=0x7f1e5d148c08 "/tmp/php-5.6.9/ext/pdo/pdo_stmt.c",
__zend_lineno=2053, __zend_orig_filename=0x0, __zend_orig_lineno=0)
at /tmp/php-5.6.9/Zend/zend_alloc.c:2440
#3 0x00007f1e5d1441d7 in pdo_stmt_do_next_rowset (stmt=0x7f1e61a76ad0)
at /tmp/php-5.6.9/ext/pdo/pdo_stmt.c:2053
#4 0x00007f1e5d144333 in zim_PDOStatement_nextRowset (ht=0,
return_value=0x7f1e61a77960, return_value_ptr=0x7f1e64250200,
this_ptr=0x7f1e61a76c90, return_value_used=0) at
/tmp/php-5.6.9/ext/pdo/pdo_stmt.c:2082
#5 0x00000000006fd188 in zend_do_fcall_common_helper_SPEC
(execute_data=0x7f1e642503b8)
at /tmp/php-5.6.9/Zend/zend_vm_execute.h:558
#6 0x00000000006fd95c in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER
(execute_data=0x7f1e642503b8)
at /tmp/php-5.6.9/Zend/zend_vm_execute.h:693
#7 0x00000000006fc7f1 in execute_ex (execute_data=0x7f1e642503b8) at
/tmp/php-5.6.9/Zend/zend_vm_execute.h:363
#8 0x00000000006fc87a in zend_execute (op_array=0x7f1e6428cf30) at
/tmp/php-5.6.9/Zend/zend_vm_execute.h:388
#9 0x00000000006b9058 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /tmp/php-5.6.9/Zend/zend.c:1341
#10 0x00000000006242af in php_execute_script
(primary_file=0x7ffd72f96120) at /tmp/php-5.6.9/main/main.c:2597
#11 0x000000000076ad09 in do_cli (argc=2, argv=0x1493870) at
/tmp/php-5.6.9/sapi/cli/php_cli.c:994
#12 0x000000000076be16 in main (argc=2, argv=0x1493870) at
/tmp/php-5.6.9/sapi/cli/php_cli.c:1378
--
Edit bug report at https://bugs.php.net/bug.php?id=69757&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69757&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69757&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69757&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69757&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69757&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69757&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69757&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69757&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69757&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69757&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69757&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69757&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69757&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69757&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69757&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69757&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69757&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69757&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69757&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69757&r=mysqlcfg
Thread (4 messages)
- miracle at rpz dot name