diff options
author | drh <> | 2024-09-20 12:58:15 +0000 |
---|---|---|
committer | drh <> | 2024-09-20 12:58:15 +0000 |
commit | 7f0e0c7dbfdf7c0c408d13f7324adb208e4832c9 (patch) | |
tree | b9f27132887a0f0ca9221348519fbaf456006131 /src | |
parent | db467f57778bedcdf2b1c2de2228457c4f8c065e (diff) | |
download | sqlite-7f0e0c7dbfdf7c0c408d13f7324adb208e4832c9.tar.gz sqlite-7f0e0c7dbfdf7c0c408d13f7324adb208e4832c9.zip |
New assert()s to help verify union access. No logic changes. Testing and
validation code only.
FossilOrigin-Name: b7b64c53f5d7f6b405ee3f1f1be1d84230aa79db5a502c8ad78d3e524f4384fb
Diffstat (limited to 'src')
-rw-r--r-- | src/delete.c | 1 | ||||
-rw-r--r-- | src/resolve.c | 6 | ||||
-rw-r--r-- | src/vdbeapi.c | 4 | ||||
-rw-r--r-- | src/vtab.c | 1 | ||||
-rw-r--r-- | src/where.c | 4 |
5 files changed, 12 insertions, 4 deletions
diff --git a/src/delete.c b/src/delete.c index 4cdb3946e..8fac7c2f3 100644 --- a/src/delete.c +++ b/src/delete.c @@ -75,6 +75,7 @@ void sqlite3CodeChangeCount(Vdbe *v, int regCounter, const char *zColName){ ** is for a top-level SQL statement. */ static int vtabIsReadOnly(Parse *pParse, Table *pTab){ + assert( IsVirtual(pTab) ); if( sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 ){ return 1; } diff --git a/src/resolve.c b/src/resolve.c index b755cc864..2e4462ac0 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -1119,8 +1119,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ /* Resolve function names */ case TK_FUNCTION: { - ExprList *pList = pExpr->x.pList; /* The argument list */ - int n = pList ? pList->nExpr : 0; /* Number of arguments */ + ExprList *pList; /* The argument list */ + int n; /* Number of arguments */ int no_such_func = 0; /* True if no such function exists */ int wrong_num_args = 0; /* True if wrong number of arguments */ int is_agg = 0; /* True if is an aggregate function */ @@ -1133,6 +1133,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ #endif assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) ); assert( pExpr->pLeft==0 || pExpr->pLeft->op==TK_ORDER ); + pList = pExpr->x.pList; + n = pList ? pList->nExpr : 0; zId = pExpr->u.zToken; pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0); if( pDef==0 ){ diff --git a/src/vdbeapi.c b/src/vdbeapi.c index c129b9465..b6ad5f3d9 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -2232,8 +2232,10 @@ int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ if( p->apDflt==0 ) goto preupdate_old_out; } if( p->apDflt[iIdx]==0 ){ - Expr *pDflt = p->pTab->u.tab.pDfltList->a[pCol->iDflt-1].pExpr; sqlite3_value *pVal = 0; + Expr *pDflt; + assert( p->pTab!=0 && IsOrdinaryTable(p->pTab) ); + pDflt = p->pTab->u.tab.pDfltList->a[pCol->iDflt-1].pExpr; rc = sqlite3ValueFromExpr(db, pDflt, ENC(db), pCol->affinity, &pVal); if( rc==SQLITE_OK && pVal==0 ){ rc = SQLITE_CORRUPT_BKPT; diff --git a/src/vtab.c b/src/vtab.c index 1036eed44..76ad3613e 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -867,6 +867,7 @@ int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ Table *pNew = sParse.pNewTable; Index *pIdx; pTab->aCol = pNew->aCol; + assert( IsOrdinaryTable(pNew) ); sqlite3ExprListDelete(db, pNew->u.tab.pDfltList); pTab->nNVCol = pTab->nCol = pNew->nCol; pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid); diff --git a/src/where.c b/src/where.c index 35da4caa6..9aaa082cd 100644 --- a/src/where.c +++ b/src/where.c @@ -1636,9 +1636,11 @@ static void freeIndexInfo(sqlite3 *db, sqlite3_index_info *pIdxInfo){ ** that this is required. */ static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){ - sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab; int rc; + sqlite3_vtab *pVtab; + assert( IsVirtual(pTab) ); + pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab; whereTraceIndexInfoInputs(p, pTab); pParse->db->nSchemaLock++; rc = pVtab->pModule->xBestIndex(pVtab, p); |