SQLite Database Browser (http://sqlitebrowser.sourceforge.net/, open source visual tool for SQLite database files SQLite)

Browser hangs after incorrect select - ID: 3413275

Posted fix to existing bug:

https://sourceforge.net/tracker/?func=detail&aid=3413275&group_id=87946&atid=584909

https://sourceforge.net/tracker/?func=detail&aid=2944573&group_id=87946&atid=584909

Tracked down the problem to form1.cpp/void mainForm::executeQuery(). In case sqlite3_prepare() fails the output parameter tail is not set, but used in the loop.

Patch against sqlitebrowser_200_b1_src.tar.gz source 0001-Fix-crash-on-erroneous-sql-query-string.patch

From f1a5835a52e76ff12441a732c17f5a86100d51cf Mon Sep 17 00:00:00 2001
From: Peter Seiderer 
Date: Mon, 13 Feb 2012 22:01:19 +0100
Subject: [PATCH] Fix crash on erroneous sql query string.

Do not use unset variable tail in case sqlite3_prepare() fails.
---
 sqlitebrowser/form1.cpp |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/sqlitebrowser/form1.cpp b/sqlitebrowser/form1.cpp
index a750568..0718e1a 100644
--- a/sqlitebrowser/form1.cpp
+++ b/sqlitebrowser/form1.cpp
@@ -879,6 +879,8 @@ void mainForm::executeQuery()
           sqlite3_finalize(vm);
         }else{
           lastErrorMessage = QString (sqlite3_errmsg(db._db));
+          queryErrorLineEdit->setText(lastErrorMessage);
+          break;
         }
        queryErrorLineEdit->setText(lastErrorMessage);
        queryResultListView->setResizeMode(Q3ListView::AllColumns);
-- 
1.7.7


<< back to projects page