1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Do not segfault even if sqlite is misused by requesting query results

after the query has been reset.  ticket #2426. (CVS 4090)

FossilOrigin-Name: 783f19be387561fbca3ac7e223bdb7dedb5450c8
This commit is contained in:
drh
2007-06-19 10:58:24 +00:00
parent 63fff5f7a5
commit b21f87dda1
4 changed files with 25 additions and 11 deletions

View File

@@ -453,7 +453,7 @@ int sqlite3_data_count(sqlite3_stmt *pStmt){
static Mem *columnMem(sqlite3_stmt *pStmt, int i){
Vdbe *pVm = (Vdbe *)pStmt;
int vals = sqlite3_data_count(pStmt);
if( i>=vals || i<0 ){
if( pVm==0 || pVm->resOnStack==0 || i>=pVm->nResColumn || i<0 ){
static const Mem nullMem = {{0}, 0.0, "", 0, MEM_Null, SQLITE_NULL };
sqlite3Error(pVm->db, SQLITE_RANGE, 0);
return (Mem*)&nullMem;