fix invalid read
This commit is contained in:
parent
b8fbb804cc
commit
3964f01793
|
@ -4273,14 +4273,6 @@ int32_t tCompressData(void *input, // input
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
buffer = &local;
|
buffer = &local;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (info->cmprAlg == TWO_STAGE_COMP) {
|
|
||||||
// code = tBufferEnsureCapacity(buffer, extraSizeNeeded);
|
|
||||||
// if (code) {
|
|
||||||
// tBufferDestroy(&local);
|
|
||||||
// return code;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
code = tBufferEnsureCapacity(buffer, extraSizeNeeded);
|
code = tBufferEnsureCapacity(buffer, extraSizeNeeded);
|
||||||
|
|
||||||
info->compressedSize = tDataCompress[info->dataType].compFunc( //
|
info->compressedSize = tDataCompress[info->dataType].compFunc( //
|
||||||
|
@ -4358,13 +4350,6 @@ int32_t tDecompressData(void *input, // input
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
buffer = &local;
|
buffer = &local;
|
||||||
}
|
}
|
||||||
// if (info->cmprAlg == TWO_STAGE_COMP) {
|
|
||||||
// code = tBufferEnsureCapacity(buffer, info->originalSize + COMP_OVERFLOW_BYTES);
|
|
||||||
// if (code) {
|
|
||||||
// tBufferDestroy(&local);
|
|
||||||
// return code;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
code = tBufferEnsureCapacity(buffer, info->originalSize + COMP_OVERFLOW_BYTES);
|
code = tBufferEnsureCapacity(buffer, info->originalSize + COMP_OVERFLOW_BYTES);
|
||||||
|
|
||||||
int32_t decompressedSize = tDataCompress[info->dataType].decompFunc(
|
int32_t decompressedSize = tDataCompress[info->dataType].decompFunc(
|
||||||
|
|
|
@ -501,7 +501,8 @@ void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb, int3
|
||||||
SColCmprWrapper *pCmpr = &req.colCmpr;
|
SColCmprWrapper *pCmpr = &req.colCmpr;
|
||||||
pCmpr->version = pStb->colVer;
|
pCmpr->version = pStb->colVer;
|
||||||
pCmpr->nCols = pStb->numOfColumns;
|
pCmpr->nCols = pStb->numOfColumns;
|
||||||
req.colCmpr.pColCmpr = taosMemoryCalloc(1, sizeof(SColCmpr));
|
|
||||||
|
req.colCmpr.pColCmpr = taosMemoryCalloc(pCmpr->nCols, sizeof(SColCmpr));
|
||||||
for (int32_t i = 0; i < pStb->numOfColumns; i++) {
|
for (int32_t i = 0; i < pStb->numOfColumns; i++) {
|
||||||
SColCmpr *p = &pCmpr->pColCmpr[i];
|
SColCmpr *p = &pCmpr->pColCmpr[i];
|
||||||
p->alg = pStb->pCmpr[i].cmprAlg;
|
p->alg = pStb->pCmpr[i].cmprAlg;
|
||||||
|
|
|
@ -1625,6 +1625,8 @@ static int32_t tBlockDataCompressKeyPart(SBlockData *bData, SDiskDataHdr *hdr, S
|
||||||
.dataType = TSDB_DATA_TYPE_TIMESTAMP,
|
.dataType = TSDB_DATA_TYPE_TIMESTAMP,
|
||||||
.originalSize = sizeof(TSKEY) * bData->nRow,
|
.originalSize = sizeof(TSKEY) * bData->nRow,
|
||||||
};
|
};
|
||||||
|
// tsdbGetColCmprAlgFromSet(compressInfo->pColCmpr, 1, &cinfo.cmprAlg);
|
||||||
|
|
||||||
code = tCompressDataToBuffer((uint8_t *)bData->aTSKEY, &cinfo, buffer, assist);
|
code = tCompressDataToBuffer((uint8_t *)bData->aTSKEY, &cinfo, buffer, assist);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
hdr->szKey = cinfo.compressedSize;
|
hdr->szKey = cinfo.compressedSize;
|
||||||
|
|
|
@ -300,14 +300,14 @@ int32_t dataConverToStr(char* str, int type, void* buf, int32_t bufSize, int32_t
|
||||||
n = sprintf(str, "%e", GET_DOUBLE_VAL(buf));
|
n = sprintf(str, "%e", GET_DOUBLE_VAL(buf));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_VARBINARY:{
|
case TSDB_DATA_TYPE_VARBINARY: {
|
||||||
if (bufSize < 0) {
|
if (bufSize < 0) {
|
||||||
// tscError("invalid buf size");
|
// tscError("invalid buf size");
|
||||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
void* data = NULL;
|
void* data = NULL;
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
if(taosAscii2Hex(buf, bufSize, &data, &size) < 0){
|
if (taosAscii2Hex(buf, bufSize, &data, &size) < 0) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
*str = '"';
|
*str = '"';
|
||||||
|
@ -475,6 +475,8 @@ int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst) {
|
||||||
if (useCompress(pSrc->tableType)) {
|
if (useCompress(pSrc->tableType)) {
|
||||||
(*pDst)->schemaExt = (SSchemaExt*)((char*)*pDst + metaSize);
|
(*pDst)->schemaExt = (SSchemaExt*)((char*)*pDst + metaSize);
|
||||||
memcpy((*pDst)->schemaExt, pSrc->schemaExt, schemaExtSize);
|
memcpy((*pDst)->schemaExt, pSrc->schemaExt, schemaExtSize);
|
||||||
|
} else {
|
||||||
|
(*pDst)->schemaExt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -592,10 +594,9 @@ int32_t cloneSVreateTbReq(SVCreateTbReq* pSrc, SVCreateTbReq** pDst) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeDbCfgInfo(SDbCfgInfo *pInfo) {
|
void freeDbCfgInfo(SDbCfgInfo* pInfo) {
|
||||||
if (pInfo) {
|
if (pInfo) {
|
||||||
taosArrayDestroy(pInfo->pRetensions);
|
taosArrayDestroy(pInfo->pRetensions);
|
||||||
}
|
}
|
||||||
taosMemoryFree(pInfo);
|
taosMemoryFree(pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -402,7 +402,7 @@ int32_t queryCreateCTableMetaFromMsg(STableMetaRsp *msg, SCTableMeta *pMeta) {
|
||||||
int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta **pMeta) {
|
int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta **pMeta) {
|
||||||
int32_t total = msg->numOfColumns + msg->numOfTags;
|
int32_t total = msg->numOfColumns + msg->numOfTags;
|
||||||
int32_t metaSize = sizeof(STableMeta) + sizeof(SSchema) * total;
|
int32_t metaSize = sizeof(STableMeta) + sizeof(SSchema) * total;
|
||||||
int32_t schemaExtSize = sizeof(SSchemaExt) * msg->numOfColumns;
|
int32_t schemaExtSize = useCompress(msg->tableType) ? sizeof(SSchemaExt) * msg->numOfColumns : 0;
|
||||||
|
|
||||||
STableMeta *pTableMeta = taosMemoryCalloc(1, metaSize + schemaExtSize);
|
STableMeta *pTableMeta = taosMemoryCalloc(1, metaSize + schemaExtSize);
|
||||||
if (NULL == pTableMeta) {
|
if (NULL == pTableMeta) {
|
||||||
|
|
Loading…
Reference in New Issue