[TD-5504]<fix>fix tsdbRestoreLastColumns run time bug:memory heap overflow
This commit is contained in:
parent
6a9d94fd97
commit
f5758a29da
|
@ -735,11 +735,12 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// save not-null column
|
// save not-null column
|
||||||
|
uint16_t bytes = IS_VAR_DATA_TYPE(pCol->type) ? varDataTLen(tdGetColDataOfRow(pDataCol, rowId)) : TYPE_BYTES[pCol->type];
|
||||||
SDataCol *pLastCol = &(pTable->lastCols[idx]);
|
SDataCol *pLastCol = &(pTable->lastCols[idx]);
|
||||||
pLastCol->pData = malloc(pCol->bytes);
|
pLastCol->pData = malloc(bytes);
|
||||||
pLastCol->bytes = pCol->bytes;
|
pLastCol->bytes = bytes;
|
||||||
pLastCol->colId = pCol->colId;
|
pLastCol->colId = pCol->colId;
|
||||||
memcpy(pLastCol->pData, value, pCol->bytes);
|
memcpy(pLastCol->pData, value, bytes);
|
||||||
|
|
||||||
// save row ts(in column 0)
|
// save row ts(in column 0)
|
||||||
pDataCol = pReadh->pDCols[0]->cols + 0;
|
pDataCol = pReadh->pDCols[0]->cols + 0;
|
||||||
|
|
Loading…
Reference in New Issue