未验证 提交 85bbe4e8 编写于 作者: G Ganlin Zhao 提交者: GitHub

Merge pull request #11755 from taosdata/feature/3.0_glzhao

refactor(query): limit cast var type length to 1000
......@@ -339,7 +339,7 @@ static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
int32_t para2Bytes = pFunc->node.resType.bytes;
if (para2Bytes <= 0) { //non-positive value or overflow
if (para2Bytes <= 0 || para2Bytes > 1000) { //cast dst var type length limits to 1000
return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName);
}
return TSDB_CODE_SUCCESS;
......
......@@ -644,9 +644,9 @@ int32_t substrFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
}
int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
int16_t inputType = pInput[0].columnData->info.type;
int16_t outputType = pOutput[0].columnData->info.type;
int64_t outputLen = pOutput[0].columnData->info.bytes;
int16_t inputType = GET_PARAM_TYPE(&pInput[0]);
int16_t outputType = GET_PARAM_TYPE(&pOutput[0]);
int64_t outputLen = GET_PARAM_BYTES(&pOutput[0]);
if (IS_VAR_DATA_TYPE(outputType)) {
int32_t factor = (TSDB_DATA_TYPE_NCHAR == outputType) ? TSDB_NCHAR_SIZE : 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册