diff options
author | drh <> | 2022-06-09 16:19:01 +0000 |
---|---|---|
committer | drh <> | 2022-06-09 16:19:01 +0000 |
commit | 8878f8a8d3157890c22dceb2ddddeac9342131a2 (patch) | |
tree | b0fc6b64afccfd46a23e39c60e85c7ed2647f997 /src/expr.c | |
parent | 048366800703333b52defea747b902f67aad931f (diff) | |
download | sqlite-8878f8a8d3157890c22dceb2ddddeac9342131a2.tar.gz sqlite-8878f8a8d3157890c22dceb2ddddeac9342131a2.zip |
The subtype of a value should not propagate across a subquery boundary.
Proposed fix for the problem reported by
[forum:/forumpost/3d9caa45cbe38c78|forum post 3d9caa45cbe38c78].
Additional works is needed as not all cases are covered.
FossilOrigin-Name: 08af1fe27ebd0edf6e0f1ac477deea033e7f7c813f1016b75196836daf02d2e4
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c index 09b56f489..c0b2bee94 100644 --- a/src/expr.c +++ b/src/expr.c @@ -4577,8 +4577,24 @@ expr_code_doover: exprCodeBetween(pParse, pExpr, target, 0, 0); return target; } + case TK_COLLATE: { + if( !ExprHasProperty(pExpr, EP_Collate) + && ALWAYS(pExpr->pLeft) + && pExpr->pLeft->op==TK_FUNCTION + ){ + inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); + if( inReg!=target ){ + sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); + inReg = target; + } + sqlite3VdbeAddOp1(v, OP_ClrSubtype, inReg); + return inReg; + }else{ + pExpr = pExpr->pLeft; + goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */ + } + } case TK_SPAN: - case TK_COLLATE: case TK_UPLUS: { pExpr = pExpr->pLeft; goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. OSSFuzz. */ |