iliaa           Wed Jan 14 16:17:09 2004 EDT

  Added files:                 
    /php-src/ext/sqlite/tests   bug26911.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/sqlite sqlite.c 
  Log:
  MFH: Fixed bug #26911 (crash in sqlite extension when fetching data from 
  empty queries).
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1575 php-src/NEWS:1.1576
--- php-src/NEWS:1.1575 Wed Jan 14 12:08:25 2004
+++ php-src/NEWS        Wed Jan 14 16:17:07 2004
@@ -6,6 +6,8 @@
   (Derick)
 - Fixed problems with longlong values in mysqli. (Georg)
 - Fixed class name case preserving of user defined classes. (Marcus)
+- Fixed bug #26911 (crash in sqlite extension when fetching data from empty 
+  queries). (Ilia)
 - Fixed bug #26819 (http_build_query() crashes on NULL output). (Ilia)
 - Fixed bug #26817 (http_build_query() does not handle private & protected 
   object properties correctly). (Ilia)
Index: php-src/ext/sqlite/sqlite.c
diff -u php-src/ext/sqlite/sqlite.c:1.112 php-src/ext/sqlite/sqlite.c:1.113
--- php-src/ext/sqlite/sqlite.c:1.112   Sun Jan 11 19:21:14 2004
+++ php-src/ext/sqlite/sqlite.c Wed Jan 14 16:17:08 2004
@@ -17,7 +17,7 @@
    |          Marcus Boerger <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
 
-   $Id: sqlite.c,v 1.112 2004/01/12 00:21:14 helly Exp $ 
+   $Id: sqlite.c,v 1.113 2004/01/14 21:17:08 iliaa Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1058,7 +1058,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_header(2, "SQLite support", "enabled");
-       php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " 
$Id: sqlite.c,v 1.112 2004/01/12 00:21:14 helly Exp $");
+       php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " 
$Id: sqlite.c,v 1.113 2004/01/14 21:17:08 iliaa Exp $");
        php_info_print_table_row(2, "SQLite Library", sqlite_libversion());
        php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding());
        php_info_print_table_end();
@@ -1455,6 +1455,9 @@
        if (ret != SQLITE_OK) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
                sqlite_freemem(errtext);
+               goto terminate;
+       } else if (!res.vm) { /* empty query */
+terminate:
                if (return_value) {
                        RETURN_FALSE;
                } else {

Index: php-src/ext/sqlite/tests/bug26911.phpt
+++ php-src/ext/sqlite/tests/bug26911.phpt
--TEST--
Bug #26911 (crash when fetching data from empty queries)
--FILE--
<?php
        $db = sqlite_open(":memory:");
        $a = sqlite_query($db, "  ");
        echo "I am ok\n";
?>
--EXPECT--
I am ok

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to