From 928fd0b13f4c9f10d324fb84164ab3348deed880 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 12 Oct 2022 10:39:49 +0800 Subject: [PATCH] fix(query): interp with every(0s) casuing client crash TD-19484 --- source/libs/parser/src/parTranslater.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ab337a985f..1c7ef05087 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2914,6 +2914,7 @@ static int32_t checkFill(STranslateContext* pCxt, SFillNode* pFill, SValueNode* } else { intervalRange = pInterval->datum.i; } + if ((timeRange == 0) || (timeRange / intervalRange) >= MAX_INTERVAL_TIME_WINDOW) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE); } @@ -3140,6 +3141,12 @@ static int32_t translateInterpEvery(STranslateContext* pCxt, SNode** pEvery) { code = translateExpr(pCxt, pEvery); } + int64_t interval = ((SValueNode*)(*pEvery))->datum.i; + if (interval == 0) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, + "Unsupported time unit in EVERY clause"); + } + return code; } -- GitLab