|
| 1 | +From 716c9cccdc0716b5e8e3cdd3f68fae702f255861 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Rohit Rawat < [email protected]> |
| 3 | +Date: Wed, 19 Feb 2025 16:59:21 +0000 |
| 4 | +Subject: [PATCH] CVE-2020-13435 |
| 5 | + |
| 6 | +Taken from https://www.sqlite.org/src/info/572105de1d44bca4 |
| 7 | +--- |
| 8 | + lang/sql/sqlite/src/expr.c | 10 ++++++++-- |
| 9 | + 1 file changed, 8 insertions(+), 2 deletions(-) |
| 10 | + |
| 11 | +diff --git a/lang/sql/sqlite/src/expr.c b/lang/sql/sqlite/src/expr.c |
| 12 | +index c0e9ba6..a253446 100644 |
| 13 | +--- a/lang/sql/sqlite/src/expr.c |
| 14 | ++++ b/lang/sql/sqlite/src/expr.c |
| 15 | +@@ -2280,7 +2280,10 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ |
| 16 | + switch( op ){ |
| 17 | + case TK_AGG_COLUMN: { |
| 18 | + AggInfo *pAggInfo = pExpr->pAggInfo; |
| 19 | +- struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg]; |
| 20 | ++ struct AggInfo_col *pCol; |
| 21 | ++ assert( pAggInfo!=0 ); |
| 22 | ++ assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn ); |
| 23 | ++ pCol = &pAggInfo->aCol[pExpr->iAgg]; |
| 24 | + if( !pAggInfo->directMode ){ |
| 25 | + assert( pCol->iMem>0 ); |
| 26 | + inReg = pCol->iMem; |
| 27 | +@@ -2514,7 +2517,10 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ |
| 28 | + } |
| 29 | + case TK_AGG_FUNCTION: { |
| 30 | + AggInfo *pInfo = pExpr->pAggInfo; |
| 31 | +- if( pInfo==0 ){ |
| 32 | ++ if( pInfo==0 |
| 33 | ++ || NEVER(pExpr->iAgg<0) |
| 34 | ++ || NEVER(pExpr->iAgg>=pInfo->nFunc) |
| 35 | ++ ){ |
| 36 | + assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 37 | + sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken); |
| 38 | + }else{ |
| 39 | +-- |
| 40 | +2.40.4 |
| 41 | + |
0 commit comments