try to modify and failure

This commit is contained in:
slzhou 2022-04-24 14:21:07 +08:00
parent 6ede012af0
commit 7791ad5af1
3 changed files with 7 additions and 7 deletions

View File

@ -1574,7 +1574,7 @@ int32_t tSerializeSCreateFuncReq(void *buf, int32_t bufLen, SCreateFuncReq *pReq
}
if (tEncodeI32(&encoder, codeSize) < 0) return -1;
if (pReq->pCode != NULL) {
if (tEncodeCStr(&encoder, pReq->pCode) < 0) return -1;
if (tEncodeBinary(&encoder, pReq->pCode, codeSize) < 0) return -1;
}
int32_t commentSize = 0;

View File

@ -309,10 +309,10 @@ static int32_t mndProcessCreateFuncReq(SNodeMsg *pReq) {
goto _OVER;
}
if (createReq.pCode[0] == 0) {
terrno = TSDB_CODE_MND_INVALID_FUNC_CODE;
goto _OVER;
}
// if (createReq.pCode[0] == 0) {
// terrno = TSDB_CODE_MND_INVALID_FUNC_CODE;
// goto _OVER;
// }
if (createReq.bufSize <= 0 || createReq.bufSize > TSDB_FUNC_BUF_SIZE) {
terrno = TSDB_CODE_MND_INVALID_FUNC_BUFSIZE;

View File

@ -453,7 +453,7 @@ TEST_F(MndTestFunc, 05_Actual_code) {
strcpy(createReq.name, "udf1");
char code[300] = {0};
for (int32_t i = 0; i < sizeof(code); ++i) {
code[i] = i % 20;
code[i] = (i+1) % 20;
}
SetCode(&createReq, code, 300);
SetComment(&createReq, "comment1");
@ -507,7 +507,7 @@ TEST_F(MndTestFunc, 05_Actual_code) {
EXPECT_EQ(pFuncInfo->signature, 5);
EXPECT_STREQ("comment1", pFuncInfo->pComment);
for (int32_t i = 0; i < 300; ++i) {
EXPECT_EQ(pFuncInfo->pCode[i], i % 20);
EXPECT_EQ(pFuncInfo->pCode[i], (i+1) % 20);
}
tFreeSRetrieveFuncRsp(&retrieveRsp);
}