Merge pull request #26376 from xinjiempolde/fix/TD-30864-3.0
fix(TD-30864): taos crashed at parInsertSql.c
This commit is contained in:
commit
71af880554
|
@ -2429,17 +2429,18 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif
|
|||
}
|
||||
|
||||
// db.? situation,ensure that the only thing following the '.' mark is '?'
|
||||
char *tbNameAfterDbName = strchr(pTbName->z, '.');
|
||||
if ((tbNameAfterDbName != NULL) && (tbNameAfterDbName + 1 - pTbName->z == pTbName->n - 1) &&
|
||||
(*(tbNameAfterDbName + 1) == '?')) {
|
||||
char *tbNameAfterDbName = strnchr(pTbName->z, '.', pTbName->n, true);
|
||||
if ((tbNameAfterDbName != NULL) && (*(tbNameAfterDbName + 1) == '?')) {
|
||||
char *tbName = NULL;
|
||||
if (NULL == pCxt->pComCxt->pStmtCb) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "? only used in stmt", pTbName->z);
|
||||
}
|
||||
int32_t code = (*pCxt->pComCxt->pStmtCb->getTbNameFn)(pCxt->pComCxt->pStmtCb->pStmt, &tbName);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pTbName->z = tbName;
|
||||
pTbName->n = strlen(tbName);
|
||||
} else {
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
pTbName->z = tbName;
|
||||
pTbName->n = strlen(tbName);
|
||||
}
|
||||
|
||||
*pHasData = true;
|
||||
|
|
|
@ -790,6 +790,16 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr, bool* pIgnoreC
|
|||
return t0;
|
||||
}
|
||||
|
||||
// check the table name is '?', db.?asf is not valid.
|
||||
if (TK_NK_QUESTION == type) {
|
||||
tGetToken(&str[*i + t0.n + 2], &type);
|
||||
if (TK_NK_SPACE != type) {
|
||||
t0.type = TK_NK_ILLEGAL;
|
||||
t0.n = 0;
|
||||
return t0;
|
||||
}
|
||||
}
|
||||
|
||||
t0.n += len + 1;
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue