From 1779c952fd086c9382ccd198b8131122929f8d4d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 26 Apr 2021 17:45:54 +0800 Subject: [PATCH] [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) { -- GitLab