Skip to content

SQLite::Connector::open() crashes on db file with non existing directory #2285

Closed
@mkrivos

Description

It is expected to throw exception. But crashes on nullptr access. Patch is on the way.

To test you can try open non existing file "foo/bar/xy.db".

Affected versions: Poco from 1.8.x to latest develop

All operating systems.

Stack Dump:

#0 sqlite3_db_mutex (db=0x0) at /opt/rsys/poco/SQL/SQLite/src/sqlite3.c:142708
#1 0x00007f752fcd64cc in Poco::SQL::SQLite::Utility::SQLiteMutex::SQLiteMutex (this=0x7ffe37fd7690, pDB=) at /opt/rsys/poco/SQL/SQLite/src/Utility.cpp:62
#2 0x00007f752fcd652e in Poco::SQL::SQLite::Utility::lastErrorabi:cxx11 (pDB=pDB@entry=0x0) at /opt/rsys/poco/SQL/SQLite/src/Utility.cpp:162
#3 0x00007f752fcd85e8 in Poco::SQL::SQLite::Utility::throwException (pDB=0x0, rc=rc@entry=14, addErrMsg="") at /opt/rsys/poco/SQL/SQLite/src/Utility.cpp:229
#4 0x00007f752fcd2a22 in Poco::SQL::SQLite::SessionImpl::open (this=this@entry=0x55bc27fa6cd0, connect="") at /opt/rsys/poco/SQL/SQLite/src/SessionImpl.cpp:168
#5 0x00007f752fcd3d57 in Poco::SQL::SQLite::SessionImpl::SessionImpl (this=0x55bc27fa6cd0, fileName=..., loginTimeout=60) at /opt/rsys/poco/SQL/SQLite/src/SessionImpl.cpp:55
#6 0x00007f752fcbb3ee in Poco::SQL::SQLite::Connector::createSession (this=, connectionString="foo/bar/nonexisting.db", timeout=60) at /opt/rsys/poco/SQL/SQLite/src/Connector.cpp:49
#7 0x00007f752f9697e1 in Poco::SQL::SessionFactory::create (this=0x7f752fc75840 Poco::SQL::SessionFactory::instance()::sf, key="sqlite", connectionString="foo/bar/nonexisting.db", timeout=timeout@entry=60) at /opt/rsys/poco/SQL/src/SessionFactory.cpp:73
#8 0x00007f752f968da9 in Poco::SQL::Session::Session (this=0x7ffe37fd79e0, rConnector="sqlite", connectionString="foo/bar/nonexisting.db", timeout=60) at /opt/rsys/poco/SQL/src/Session.cpp:38
#9 0x000055bc2688c7b1 in SQLiteTest::testNonexistingDB (this=) at /opt/rsys/poco/SQL/SQLite/testsuite/src/SQLiteTest.cpp:1381
#10 0x00007f752f1f6a9d in CppUnit::TestCase::run (this=0x55bc27f67b20, result=0x7ffe37fd7b40) at /opt/rsys/poco/CppUnit/src/TestCase.cpp:116
#11 0x00007f752f1fa9dc in CppUnit::TestSuite::run (this=0x55bc27f65400, result=0x7ffe37fd7b40) at /opt/rsys/poco/CppUnit/src/TestSuite.cpp:30
#12 0x00007f752f1fa9dc in CppUnit::TestSuite::run (this=0x55bc27f653b0, result=0x7ffe37fd7b40) at /opt/rsys/poco/CppUnit/src/TestSuite.cpp:30
#13 0x00007f752f1f9f3f in CppUnit::TestRunner::run (this=this@entry=0x7ffe37fd7c90, test=0x55bc27f653b0) at /opt/rsys/poco/CppUnit/src/TestRunner.cpp:133
#14 0x00007f752f1fa20f in CppUnit::TestRunner::run (this=0x7ffe37fd7c90, args=...) at /opt/rsys/poco/CppUnit/src/TestRunner.cpp:108
#15 0x000055bc2688b302 in main (ac=, av=) at /opt/rsys/poco/SQL/SQLite/testsuite/src/Driver.cpp:17

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions