From 1779c952fd086c9382ccd198b8131122929f8d4d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 26 Apr 2021 17:45:54 +0800 Subject: [PATCH 1/3] [td-3951]: check the input value of big int which is overflowed. --- src/common/src/tvariant.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c index 7798deaa60..c872d8731b 100644 --- a/src/common/src/tvariant.c +++ b/src/common/src/tvariant.c @@ -48,6 +48,13 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) { case TSDB_DATA_TYPE_INT:{ ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, true); if (ret != 0) { + SStrToken t = {0}; + tSQLGetToken(token->z, &t.type); + if (t.type == TK_MINUS) { // it is a signed number which is greater than INT64_MAX or less than INT64_MIN + pVar->nType = -1; // -1 means error type + return; + } + // data overflow, try unsigned parse the input number ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, false); if (ret != 0) { From 6ac7b467e43ff7d3c8f20431f1b65cc615d547fc Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 26 Apr 2021 17:52:22 +0800 Subject: [PATCH 2/3] [td-225]update the log output --- src/client/src/tscParseInsert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 00960b9fc0..d21a4f7643 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -1089,7 +1089,7 @@ int tsParseInsertSql(SSqlObj *pSql) { str = pCmd->curSql; } - tscDebug("0x%"PRIx64" create data block list hashList:%p", pSql->self, pCmd->pTableBlockHashList); + tscDebug("0x%lx create data block list hashList:%p", pSql->self, pCmd->pTableBlockHashList); while (1) { int32_t index = 0; From 48b630a1169f977815ce05db2ae7b707f1a0d6b6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 26 Apr 2021 18:14:04 +0800 Subject: [PATCH 3/3] [td-225]fix compiler error. --- src/client/src/tscParseInsert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index d21a4f7643..00960b9fc0 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -1089,7 +1089,7 @@ int tsParseInsertSql(SSqlObj *pSql) { str = pCmd->curSql; } - tscDebug("0x%lx create data block list hashList:%p", pSql->self, pCmd->pTableBlockHashList); + tscDebug("0x%"PRIx64" create data block list hashList:%p", pSql->self, pCmd->pTableBlockHashList); while (1) { int32_t index = 0;