Bug 504634

Summary: Sqlite "PRAGMA user_version" causes a segfault in PHP
Product: Red Hat Enterprise Linux 5 Reporter: Olivier Fourdan <ofourdan>
Component: sqliteAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: high Docs Contact:
Priority: high    
Version: 5.3CC: azelinka, cww, jkalliya, jscotka, kem, pknirsch, tao, urkle
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sqlite-3.3.6-6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-08 07:33:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 590060, 743405, 807971    
Attachments:
Description Flags
Proposed patch none

Description Olivier Fourdan 2009-06-08 15:38:40 UTC
Created attachment 346893 [details]
Proposed patch

Description of problem:

The "PRAGMA user_version" returns NULL as the column heading and that causes a segmentation fault in PHP

Version-Release number of selected component (if applicable):

sqlite-3.3.6-2

How reproducible:

100% reproducible

Steps to Reproduce:
1. Install php and php-pdo
   # yum install php php-pdo
2. Prepare a test.php file that uses "PRAGMA user_version"

  $db = new PDO("sqlite:test.sqlite");
  $r = $db->query("PRAGMA encoding");
  echo "Current Encoding:".$r->fetchColumn()."\n";
  $r->closeCursor();
  $r = $db->query("PRAGMA user_version");
  echo "Current User Version:".$r->fetchColumn()."\n";
  $r->closeCursor();

3. Run php test.php
  
Actual results:

$ php test.php 
Current Encoding:UTF-8
Segmentation fault (core dumped)

Expected results:

$ php test.php 
Current Encoding:UTF-8
Current User Version:0

Additional info:

PHP crashes because "PRAGMA user_version" returns NULL as the column heading:

    $ sqlite3 
    SQLite version 3.3.6
    Enter ".help" for instructions
    sqlite> .headers on
    sqlite> PRAGMA user_version;
    (null)
    0
    sqlite>

This is bug #2143 upstream:

    http://www.sqlite.org/cvstrac/tktview?tn=2143

That was fixed with the Changeset #3560

    http://www.sqlite.org/cvstrac/chngview?cn=3560

Applying the patch fixes the issue in sqlite:

    $ sqlite3 
    SQLite version 3.3.6
    Enter ".help" for instructions
    sqlite> .headers on
    sqlite> PRAGMA user_version;
    user_version
    0
    sqlite>

And PHP does not crash anymore.

Comment 2 RHEL Program Management 2009-11-06 19:13:08 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 5 RHEL Program Management 2010-08-09 19:27:51 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 12 RHEL Program Management 2011-05-31 15:39:33 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 22 errata-xmlrpc 2013-01-08 07:33:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0063.html