From c9f316c8b90ce8bb11b6e9e0bf898c269cd35bfb Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 11 Sep 2018 19:18:35 +0200 Subject: ODBC: Correctly check if the field is within the fieldCache range This was found while running the ODBC tests. tst_QSqlQuery::isNull() accounts for this already. Change-Id: Idf99a85396d7aa4e69b89467f873b105ef946f7f Reviewed-by: Christian Ehrlicher Reviewed-by: Edward Welbourne --- src/plugins/sqldrivers/odbc/qsql_odbc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index daf9686b5e..1fbbcd0ef1 100644 --- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp @@ -1307,7 +1307,7 @@ QVariant QODBCResult::data(int field) bool QODBCResult::isNull(int field) { Q_D(const QODBCResult); - if (field < 0 || field > d->fieldCache.size()) + if (field < 0 || field >= d->fieldCache.size()) return true; if (field <= d->fieldCacheIdx) { // since there is no good way to find out whether the value is NULL -- cgit v1.2.3