fix: add block decode check

This commit is contained in:
dapan1121 2024-09-02 16:28:43 +08:00
parent 93568271e1
commit 1bf581db49
1 changed files with 7 additions and 1 deletions

View File

@ -3036,6 +3036,11 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos
// total rows sizeof(int32_t)
int32_t numOfRows = *(int32_t*)pStart;
pStart += sizeof(int32_t);
if (numOfRows <= 0) {
uError("block decode numOfRows:%d error", numOfRows);
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
return terrno;
}
// total columns sizeof(int32_t)
int32_t numOfCols = *(int32_t*)pStart;
@ -3084,8 +3089,9 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos
for (int32_t i = 0; i < numOfCols; ++i) {
colLen[i] = htonl(colLen[i]);
if (colLen[i] < 0) {
if (colLen[i] <= 0) {
uError("block decode colLen:%d error, colIdx:%d", colLen[i], i);
ASSERT(0);
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
return terrno;
}