mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-24 08:21:29 +03:00
New assert() statements to verify that Expr.iColumn is never used as an
array index when its value is negative. FossilOrigin-Name: 6084c5fb6d3fcedf35cd6c597a44ec7bf8b4a2576c7b277e5342d2a7905318e7
This commit is contained in:
10
src/delete.c
10
src/delete.c
@@ -226,14 +226,20 @@ Expr *sqlite3LimitWhere(
|
||||
);
|
||||
}else{
|
||||
Index *pPk = sqlite3PrimaryKeyIndex(pTab);
|
||||
assert( pPk!=0 );
|
||||
assert( pPk->nKeyCol>=1 );
|
||||
if( pPk->nKeyCol==1 ){
|
||||
const char *zName = pTab->aCol[pPk->aiColumn[0]].zCnName;
|
||||
const char *zName;
|
||||
assert( pPk->aiColumn[0]>=0 && pPk->aiColumn[0]<pTab->nCol );
|
||||
zName = pTab->aCol[pPk->aiColumn[0]].zCnName;
|
||||
pLhs = sqlite3Expr(db, TK_ID, zName);
|
||||
pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ID, zName));
|
||||
}else{
|
||||
int i;
|
||||
for(i=0; i<pPk->nKeyCol; i++){
|
||||
Expr *p = sqlite3Expr(db, TK_ID, pTab->aCol[pPk->aiColumn[i]].zCnName);
|
||||
Expr *p;
|
||||
assert( pPk->aiColumn[i]>=0 && pPk->aiColumn[i]<pTab->nCol );
|
||||
p = sqlite3Expr(db, TK_ID, pTab->aCol[pPk->aiColumn[i]].zCnName);
|
||||
pEList = sqlite3ExprListAppend(pParse, pEList, p);
|
||||
}
|
||||
pLhs = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user