diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 9a7d1a5c36d71fbcdbab650c531a176b55b5240c..e0426cc2f0491bf363f2f61e235d9764fe2462e5 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -727,12 +727,14 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo char* p = pRes->urow[i]; for (int32_t k = 0; k < pRes->numOfRows; ++k) { char* dst = pRes->buffer[i] + k * pInfo->field.bytes; + p = varDataVal(p); char* realData = p + CHAR_BYTES; if (*p == SELECT_ALL_JSON_TAG){ char* json = parseTagDatatoJson(realData, pInfo->field.type); if(json) { memcpy(varDataVal(dst), json, strlen(json)); varDataSetLen(dst, strlen(json)); + assert(varDataTLen(dst) <= pInfo->field.type); tfree(json); } }else if (*p == SELECT_ELEMENT_JSON_TAG){ diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 48d86df436bc1238516163ec6b390481d4fe09c5..c98e287edacfbce520dfbc6957a75545ccddf9a1 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -3362,6 +3362,7 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, tVariant *tag, tVariantCreateFromBinary(tag, val, bytes, type); memcpy(tag->pz + 1, tag->pz, bytes - 1); // move back 1 byte for select type *(tag->pz) = SELECT_ALL_JSON_TAG; + tag->nLen++; } else { tVariantCreateFromBinary(tag, val, bytes, type);