php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53461 Segmentation fault when reading clob with pdo oci
Submitted: 2010-12-03 11:01 UTC Modified: 2016-03-08 01:28 UTC
From: stephen dot lucius dot wolf at gmail dot com Assigned:
Status: Duplicate Package: PDO OCI
PHP Version: 5.3.3 OS: RedHat 5.1.2
Private report: No CVE-ID: None
 [2010-12-03 11:01 UTC] stephen dot lucius dot wolf at gmail dot com
Description:
------------
when fetching a clob value with pdo oci a segmentation fault is generated when the result contains more than one entry. works fine with only one result.

db:
column name     data type 
ID              NUMBER
LARGE           CLOB

Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
Zend Server Community Edition Version 5.0.3
Apache/2.2.15 (Unix) PHP/5.3.3

oci8
Version 	1.4.1
Revision 	$Revision: 293235 $ 

Test script:
---------------
    // LARGE is a CLOB, the database contains 2 entries with id=1
    $sql = 'SELECT ID, LARGE FROM TEST WHERE ID LIKE :id';
    $bind = array(':id'=>'%1');

    $rows = null;
    try 
    {
        $pdo = new PDO('oci:dbname=xe;host=localhost:1521','username','pw');
        $statement = $pdo->prepare($sql);
        foreach($bind as $key=>$value)
        {
            $statement->bindValue($key,$value);
        }
        $result = $statement->execute();
        if( $result )
            $rows = $statement->fetchAll(PDO::FETCH_ASSOC);
            
    }
    catch (PDOException $e)
    {
        die($e->getMessage());
    }

    count($rows) > 0 ? $problem = stream_get_contents($rows[0]['LARGE']) :   $problem = 'empty';
    echo $problem;  

Expected result:
----------------
the first 'LARGE' value

Actual result:
--------------
[Thread debugging using libthread_db enabled]
[New Thread 0x110ac0 (LWP 10305)]
Detaching after fork from child process 10308.
Detaching after fork from child process 10309.

Program received signal SIGSEGV, Segmentation fault.
0x04926761 in kghufree () from /usr/local/zend/lib/libclntsh.so.11.1
(gdb) bt
#0  0x04926761 in kghufree () from /usr/local/zend/lib/libclntsh.so.11.1
#1  0x04913f27 in kohfrem () from /usr/local/zend/lib/libclntsh.so.11.1
#2  0x04913668 in kohfrr () from /usr/local/zend/lib/libclntsh.so.11.1
#3  0x0491360e in kohfrw () from /usr/local/zend/lib/libclntsh.so.11.1
#4  0x048eb068 in kollfrfn () from /usr/local/zend/lib/libclntsh.so.11.1
#5  0x03144fd7 in kpufdesc2 () from /usr/local/zend/lib/libclntsh.so.11.1
#6  0x03147dcb in kpufdesc () from /usr/local/zend/lib/libclntsh.so.11.1
#7  0x0311ce40 in OCIDescriptorFree () from /usr/local/zend/lib/libclntsh.so.11.1
#8  0x0021f2ca in ?? () from /usr/local/zend/lib/php_extensions/pdo_oci.so
#9  0x0956e0cc in ?? ()
#10 0x00000032 in ?? ()
#11 0x0956e0cc in ?? ()
#12 0x013a956c in ?? () from /usr/local/zend/apache2/modules/libphp5.so
#13 0x09450264 in ?? ()
#14 0x00000000 in ?? ()


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-07 08:39 UTC] sixd@php.net
-Status: Open +Status: Duplicate
 [2010-12-07 08:39 UTC] sixd@php.net
Duplicate of http://pecl.php.net/bugs/bug.php?id=11320
Also see http://bugs.php.net/bug.php?id=39199 for a patch
for PDO_OCI and stream_get_contents()
 [2016-03-08 01:28 UTC] sixd@php.net
-Package: PDO related +Package: PDO OCI
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Dec 02 10:01:24 2020 UTC