devbean / QtCipherSqlitePlugin

A Qt plugin for cipher SQLite.
http://qtciphersqliteplugin.galaxyworld.org
GNU Lesser General Public License v2.1
392 stars 159 forks source link

bug(sqlite3_reset) #29

Open lpwwpl opened 4 years ago

lpwwpl commented 4 years ago

in fetchNext func, sqlite3_reset cause crash, stmt is NULL or wild pointer

fetchNext func{ ... case SQLITE_DONE: if (rInf.isEmpty()) // must be first call. initColumns(true); q->setAt(QSql::AfterLastRow);

sqlite3_reset(stmt);

case SQLITE_CONSTRAINT:
case SQLITE_ERROR:
    // SQLITE_ERROR is a generic error code and we must call sqlite3_reset()
    // to get the specific error message.
    ### res = sqlite3_reset(stmt);
    q->setLastError(qMakeError(access, QCoreApplication::translate("QSQLiteResult",
                    "Unable to fetch row"), QSqlError::ConnectionError, res));
    q->setAt(QSql::AfterLastRow);
    return false;
case SQLITE_MISUSE:
case SQLITE_BUSY:
default:
    // something wrong, don't get col info, but still return false
    q->setLastError(qMakeError(access, QCoreApplication::translate("QSQLiteResult",
                    "Unable to fetch row"), QSqlError::ConnectionError, res));
    ### sqlite3_reset(stmt);
    q->setAt(QSql::AfterLastRow);
    return false;
}

... }