Merge pull request #18113 from taosdata/fix/asanIssues
fix: fix asan issues
This commit is contained in:
commit
2c265b861b
|
@ -346,8 +346,8 @@ bool isValidDataType(int32_t type);
|
||||||
|
|
||||||
void assignVal(char *val, const char *src, int32_t len, int32_t type);
|
void assignVal(char *val, const char *src, int32_t len, int32_t type);
|
||||||
void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type);
|
void operateVal(void *dst, void *s1, void *s2, int32_t optr, int32_t type);
|
||||||
void *getDataMin(int32_t type);
|
void *getDataMin(int32_t type, void* value);
|
||||||
void *getDataMax(int32_t type);
|
void *getDataMax(int32_t type, void* value);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,26 +61,36 @@ tDataTypeDescriptor tDataTypes[TSDB_DATA_TYPE_MAX] = {
|
||||||
static float floatMin = -FLT_MAX, floatMax = FLT_MAX;
|
static float floatMin = -FLT_MAX, floatMax = FLT_MAX;
|
||||||
static double doubleMin = -DBL_MAX, doubleMax = DBL_MAX;
|
static double doubleMin = -DBL_MAX, doubleMax = DBL_MAX;
|
||||||
|
|
||||||
FORCE_INLINE void *getDataMin(int32_t type) {
|
FORCE_INLINE void *getDataMin(int32_t type, void* value) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TSDB_DATA_TYPE_FLOAT:
|
case TSDB_DATA_TYPE_FLOAT:
|
||||||
return &floatMin;
|
*(float *)value = floatMin;
|
||||||
|
break;
|
||||||
case TSDB_DATA_TYPE_DOUBLE:
|
case TSDB_DATA_TYPE_DOUBLE:
|
||||||
return &doubleMin;
|
*(double *)value = doubleMin;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return &tDataTypes[type].minValue;
|
*(int64_t *)value = tDataTypes[type].minValue;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE void *getDataMax(int32_t type) {
|
FORCE_INLINE void *getDataMax(int32_t type, void* value) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TSDB_DATA_TYPE_FLOAT:
|
case TSDB_DATA_TYPE_FLOAT:
|
||||||
return &floatMax;
|
*(float *)value = floatMax;
|
||||||
|
break;
|
||||||
case TSDB_DATA_TYPE_DOUBLE:
|
case TSDB_DATA_TYPE_DOUBLE:
|
||||||
return &doubleMax;
|
*(double *)value = doubleMax;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return &tDataTypes[type].maxValue;
|
*(int64_t *)value = tDataTypes[type].maxValue;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isValidDataType(int32_t type) { return type >= TSDB_DATA_TYPE_NULL && type < TSDB_DATA_TYPE_MAX; }
|
bool isValidDataType(int32_t type) { return type >= TSDB_DATA_TYPE_NULL && type < TSDB_DATA_TYPE_MAX; }
|
||||||
|
|
|
@ -388,8 +388,10 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
offset += sizeof(p->msgLen);
|
offset += sizeof(p->msgLen);
|
||||||
*(int32_t *)((char *)pRsp + offset) = htonl(p->rspCode);
|
*(int32_t *)((char *)pRsp + offset) = htonl(p->rspCode);
|
||||||
offset += sizeof(p->rspCode);
|
offset += sizeof(p->rspCode);
|
||||||
memcpy((char *)pRsp + offset, p->msg, p->msgLen);
|
if (p->msg) {
|
||||||
offset += p->msgLen;
|
memcpy((char *)pRsp + offset, p->msg, p->msgLen);
|
||||||
|
offset += p->msgLen;
|
||||||
|
}
|
||||||
|
|
||||||
taosMemoryFreeClear(p->msg);
|
taosMemoryFreeClear(p->msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -512,15 +512,17 @@ int32_t filterReuseRangeCtx(SFilterRangeCtx *ctx, int32_t type, int32_t options)
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t filterConvertRange(SFilterRangeCtx *cur, SFilterRange *ra, bool *notNull) {
|
int32_t filterConvertRange(SFilterRangeCtx *cur, SFilterRange *ra, bool *notNull) {
|
||||||
|
int64_t tmp = 0;
|
||||||
|
|
||||||
if (!FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) {
|
if (!FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) {
|
||||||
int32_t sr = cur->pCompareFunc(&ra->s, getDataMin(cur->type));
|
int32_t sr = cur->pCompareFunc(&ra->s, getDataMin(cur->type, &tmp));
|
||||||
if (sr == 0) {
|
if (sr == 0) {
|
||||||
FILTER_SET_FLAG(ra->sflag, RANGE_FLG_NULL);
|
FILTER_SET_FLAG(ra->sflag, RANGE_FLG_NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL)) {
|
if (!FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL)) {
|
||||||
int32_t er = cur->pCompareFunc(&ra->e, getDataMax(cur->type));
|
int32_t er = cur->pCompareFunc(&ra->e, getDataMax(cur->type, &tmp));
|
||||||
if (er == 0) {
|
if (er == 0) {
|
||||||
FILTER_SET_FLAG(ra->eflag, RANGE_FLG_NULL);
|
FILTER_SET_FLAG(ra->eflag, RANGE_FLG_NULL);
|
||||||
}
|
}
|
||||||
|
@ -696,14 +698,15 @@ int32_t filterAddRangeImpl(void *h, SFilterRange *ra, int32_t optr) {
|
||||||
|
|
||||||
int32_t filterAddRange(void *h, SFilterRange *ra, int32_t optr) {
|
int32_t filterAddRange(void *h, SFilterRange *ra, int32_t optr) {
|
||||||
SFilterRangeCtx *ctx = (SFilterRangeCtx *)h;
|
SFilterRangeCtx *ctx = (SFilterRangeCtx *)h;
|
||||||
|
int64_t tmp = 0;
|
||||||
|
|
||||||
if (FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) {
|
if (FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) {
|
||||||
SIMPLE_COPY_VALUES(&ra->s, getDataMin(ctx->type));
|
SIMPLE_COPY_VALUES(&ra->s, getDataMin(ctx->type, &tmp));
|
||||||
// FILTER_CLR_FLAG(ra->sflag, RA_NULL);
|
// FILTER_CLR_FLAG(ra->sflag, RA_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL)) {
|
if (FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL)) {
|
||||||
SIMPLE_COPY_VALUES(&ra->e, getDataMax(ctx->type));
|
SIMPLE_COPY_VALUES(&ra->e, getDataMax(ctx->type, &tmp));
|
||||||
// FILTER_CLR_FLAG(ra->eflag, RA_NULL);
|
// FILTER_CLR_FLAG(ra->eflag, RA_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,9 +286,11 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
|
||||||
if (pJob->execRes.res) {
|
if (pJob->execRes.res) {
|
||||||
SSubmitRsp *sum = pJob->execRes.res;
|
SSubmitRsp *sum = pJob->execRes.res;
|
||||||
sum->affectedRows += rsp->affectedRows;
|
sum->affectedRows += rsp->affectedRows;
|
||||||
sum->nBlocks += rsp->nBlocks;
|
sum->nBlocks += rsp->nBlocks;
|
||||||
sum->pBlocks = taosMemoryRealloc(sum->pBlocks, sum->nBlocks * sizeof(*sum->pBlocks));
|
if (rsp->nBlocks > 0 && rsp->pBlocks) {
|
||||||
memcpy(sum->pBlocks + sum->nBlocks - rsp->nBlocks, rsp->pBlocks, rsp->nBlocks * sizeof(*sum->pBlocks));
|
sum->pBlocks = taosMemoryRealloc(sum->pBlocks, sum->nBlocks * sizeof(*sum->pBlocks));
|
||||||
|
memcpy(sum->pBlocks + sum->nBlocks - rsp->nBlocks, rsp->pBlocks, rsp->nBlocks * sizeof(*sum->pBlocks));
|
||||||
|
}
|
||||||
taosMemoryFree(rsp->pBlocks);
|
taosMemoryFree(rsp->pBlocks);
|
||||||
taosMemoryFree(rsp);
|
taosMemoryFree(rsp);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue