From f5827bd9e055a1a88450f9a94685272a7540dd14 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 27 Apr 2022 18:49:02 +0800 Subject: [PATCH] fix: fix coredump if mode function with interval --- src/query/src/qExecutor.c | 6 +++--- src/query/src/qUtil.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 6531d4f7ac..1facab0b34 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -330,8 +330,8 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO int64_t tmp = idata.info.bytes; tmp *= numOfRows; - if (tmp >= 1024*1024*1024) { // 1G - qError("size is too large, failed to allocate column buffer for output buffer"); + if (tmp >= INT32_MAX) { + qError("size is too large, failed to allocate column buffer for output buffer:%" PRId64, tmp); tmp = 128*1024*1024; } size_t size = (size_t)MAX(tmp, minSize); @@ -9556,7 +9556,7 @@ void setResultBufSize(SQueryAttr* pQueryAttr, SRspResultInfo* pResultInfo) { // the minimum number of rows for projection query const int32_t MIN_ROWS_FOR_PRJ_QUERY = 8192; - const int32_t DEFAULT_MIN_ROWS = 1024; + const int32_t DEFAULT_MIN_ROWS = 4096; const float THRESHOLD_RATIO = 0.85f; diff --git a/src/query/src/qUtil.c b/src/query/src/qUtil.c index a8582f2a33..1628c2d511 100644 --- a/src/query/src/qUtil.c +++ b/src/query/src/qUtil.c @@ -204,7 +204,7 @@ SResultRowPool* initResultRowPool(size_t size) { p->elemSize = (int32_t) size; int64_t tmp = p->elemSize; tmp *= p->numOfElemPerBlock; - if (tmp > 1024*1024*1024){ + if (tmp > INT32_MAX){ qError("ResultRow blockSize is too large:%" PRId64, tmp); return NULL; } @@ -223,6 +223,7 @@ SResultRow* getNewResultRow(SResultRowPool* p) { void* ptr = NULL; if (p->position.pos == 0) { ptr = calloc(1, p->blockSize); + if(ptr == NULL) return NULL; taosArrayPush(p->pData, &ptr); } else { -- GitLab