Merge pull request #17996 from taosdata/fix/TD-20277
fix: fix valgrind invalid read error
This commit is contained in:
commit
b607f4736d
|
@ -1028,11 +1028,11 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
|
||||||
int32_t type = GET_PARAM_TYPE(pInput);
|
int32_t type = GET_PARAM_TYPE(pInput);
|
||||||
|
|
||||||
bool tzPresent = (inputNum == 2) ? true : false;
|
bool tzPresent = (inputNum == 2) ? true : false;
|
||||||
char *tz;
|
char tz[20] = {0};
|
||||||
int32_t tzLen;
|
int32_t tzLen = 0;
|
||||||
if (tzPresent) {
|
if (tzPresent) {
|
||||||
tz = varDataVal(pInput[1].columnData->pData);
|
|
||||||
tzLen = varDataLen(pInput[1].columnData->pData);
|
tzLen = varDataLen(pInput[1].columnData->pData);
|
||||||
|
memcpy(tz, varDataVal(pInput[1].columnData->pData), tzLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pInput[0].numOfRows; ++i) {
|
for (int32_t i = 0; i < pInput[0].numOfRows; ++i) {
|
||||||
|
@ -1071,8 +1071,10 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
|
||||||
int32_t len = (int32_t)strlen(buf);
|
int32_t len = (int32_t)strlen(buf);
|
||||||
|
|
||||||
// add timezone string
|
// add timezone string
|
||||||
snprintf(buf + len, tzLen + 1, "%s", tz);
|
if (tzLen > 0) {
|
||||||
len += tzLen;
|
snprintf(buf + len, tzLen + 1, "%s", tz);
|
||||||
|
len += tzLen;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasFraction) {
|
if (hasFraction) {
|
||||||
int32_t fracLen = (int32_t)strlen(fraction) + 1;
|
int32_t fracLen = (int32_t)strlen(fraction) + 1;
|
||||||
|
|
Loading…
Reference in New Issue