未验证 提交 81ae04cb 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

Hotfix/sangshuduo/td 3197 fix taosdemo coverity scan (#8003)

* [TD-3197] <fix>: fix taosdemo coverity scan issues.

* [TD-3197] <fix>: fix taosdemo coverity scan issue.

fix subscribeTest pids uninitialized.

* [TD-3197] <fix>: fix taosdemo coverity scan issues.

* [TD-3197] <fix>: fix coverity scan issues.

check super tbl info pointer.

* [TD-3197] <fix>: fix coverity scan issues.

move sub tbl query thread join into loop

* [TD-3197] <fix>: fix coverity scan issues.

remove unused variable

* [TD-3197] <fix>: fix coverity scan issues.

use more secure random library

* [TD-3197] <fix>: fix coverity scan issues.

use strncpy for more safe

* [TD-3197] <fix>: fix taosdemo coverity scan issue.

replace arc4random with rand().

* [TD-3197] <fix>: fix coverity scan issues.

check stb info pointer for start time

* [TD-3197] <fix>: fix coverity scan issues.

fix strcpy vulnerability

* [TD-3197] <fix>: fix taosdemo coverity scan issue.

modify taosdemoTest2. try to check database continously.

* [TD-3197] <fix>: taosdemo coverity scan issues.

* [TD-3197] <fix>: fix memory leak when parsing arguments.

* [TD-3197] <fix>: fix cmake strip arguments.

* [TD-3197] <fix>: taosdemo coverity scan.

fix cmake string manipulation.

* [TD-3197]<fix>: taosdemo coverity scan issue.

configDir buffer overwrite.

* [TD-3197]<fix>: coverity scan issue.

taosdump argument validation.

* [TD-3197]<fix>: taosdemo and taosdump coverity scan issues.

* [TD-3197]<fix>: taosdemo coverity scan.

append result buf to file. for develop branch.

* exit if read sample file failed.

* fix converity scan issue.

* fix coverity scan issue.

* fix coverity scan memory leak.

* fix resource leak reported by coverity scan.

* fix taosdemo coverity scan issue.

* fix tcsetattr and getchar return value determination bug.

* fix coverity scan issue.

* fix two more coverity scan issues.

* fix stmt batch coverity scan issue.

* change to portable format.
Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 056b7d6e
......@@ -8153,7 +8153,7 @@ UNUSED_FUNC static int32_t prepareStbStmtRand(
}
#if STMT_BIND_PARAM_BATCH == 1
static int execBindParamBatch(
static int execStbBindParamBatch(
threadInfo *pThreadInfo,
char *tableName,
int64_t tableSeq,
......@@ -8167,7 +8167,9 @@ static int execBindParamBatch(
TAOS_STMT *stmt = pThreadInfo->stmt;
SSuperTable *stbInfo = pThreadInfo->stbInfo;
uint32_t columnCount = (stbInfo)?pThreadInfo->stbInfo->columnCount:g_args.columnCount;
assert(stbInfo);
uint32_t columnCount = pThreadInfo->stbInfo->columnCount;
uint32_t thisBatch = MAX_SAMPLES - (*pSamplePos);
......@@ -8192,29 +8194,39 @@ static int execBindParamBatch(
param->buffer = pThreadInfo->bind_ts_array;
} else {
data_type = (stbInfo)?stbInfo->columns[c-1].data_type:g_args.data_type[c-1];
data_type = stbInfo->columns[c-1].data_type;
char *tmpP;
switch(data_type) {
case TSDB_DATA_TYPE_BINARY:
param->buffer_length =
stbInfo->columns[c-1].dataLen;
tmpP =
(char *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray
+sizeof(char*)*(c-1)));
verbosePrint("%s() LN%d, tmpP=%p pos=%"PRId64" width=%"PRIxPTR" position=%"PRId64"\n",
__func__, __LINE__, tmpP, *pSamplePos, param->buffer_length,
(*pSamplePos) * param->buffer_length);
param->buffer = (void *)(tmpP + *pSamplePos * param->buffer_length);
break;
case TSDB_DATA_TYPE_NCHAR:
param->buffer_length =
((stbInfo)?stbInfo->columns[c-1].dataLen:g_args.binwidth);
stbInfo->columns[c-1].dataLen;
tmpP =
(char *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray
+sizeof(char*)*(c-1)));
verbosePrint("%s() LN%d, tmpP=%p pos=%"PRId64" width=%d position=%"PRId64"\n",
__func__, __LINE__, tmpP, *pSamplePos,
(((stbInfo)?stbInfo->columns[c-1].dataLen:g_args.binwidth)),
(*pSamplePos) *
(((stbInfo)?stbInfo->columns[c-1].dataLen:g_args.binwidth)));
verbosePrint("%s() LN%d, tmpP=%p pos=%"PRId64" width=%"PRIxPTR" position=%"PRId64"\n",
__func__, __LINE__, tmpP, *pSamplePos, param->buffer_length,
(*pSamplePos) * param->buffer_length);
param->buffer = (void *)(tmpP + *pSamplePos *
(((stbInfo)?stbInfo->columns[c-1].dataLen:g_args.binwidth))
);
param->buffer = (void *)(tmpP + *pSamplePos * param->buffer_length);
break;
case TSDB_DATA_TYPE_INT:
......@@ -8869,7 +8881,7 @@ static int32_t prepareStbStmt(
}
#if STMT_BIND_PARAM_BATCH == 1
return execBindParamBatch(
return execStbBindParamBatch(
pThreadInfo,
tableName,
tableSeq,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册