Bug 504634 - Sqlite "PRAGMA user_version" causes a segfault in PHP
Summary: Sqlite "PRAGMA user_version" causes a segfault in PHP
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sqlite
Version: 5.3
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Panu Matilainen
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks: 590060 743405 807971
TreeView+ depends on / blocked
 
Reported: 2009-06-08 15:38 UTC by Olivier Fourdan
Modified: 2018-11-30 23:08 UTC (History)
8 users (show)

Fixed In Version: sqlite-3.3.6-6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-01-08 07:33:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch (1.77 KB, patch)
2009-06-08 15:38 UTC, Olivier Fourdan
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0063 0 normal SHIPPED_LIVE sqlite bug fix 2013-01-07 15:27:36 UTC

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


Note You need to log in before you can comment on or make changes to this bug.