Bug 504634 - Sqlite "PRAGMA user_version" causes a segfault in PHP
Sqlite "PRAGMA user_version" causes a segfault in PHP
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: sqlite (Show other bugs)
5.3
All Linux
high Severity high
: rc
: ---
Assigned To: Panu Matilainen
qe-baseos-daemons
: Patch
Depends On:
Blocks: 590060 743405 807971
  Show dependency treegraph
 
Reported: 2009-06-08 11:38 EDT by Olivier Fourdan
Modified: 2013-03-03 21:48 EST (History)
8 users (show)

See Also:
Fixed In Version: sqlite-3.3.6-6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-01-08 02:33:00 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Olivier Fourdan 2009-06-08 11:38:40 EDT
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 Product and Program Management 2009-11-06 14:13:08 EST
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 Product and Program Management 2010-08-09 15:27:51 EDT
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 Product and Program Management 2011-05-31 11:39:33 EDT
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 02:33:00 EST
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.