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

Hotfix/sangshuduo/td 3607 taosdemo buffer overflow (#5706)

* [TD-3607] <fix>: fix taosdemo buffer overflow.

* [TD-3607] <fix>: taosdemo buffer overflow.

add tmp buffer.

* [TD-3607] <fix>: taosdemo buffer overflow.

fix data generation.

* [TD-3607] <fix>: taosdemo buffer overflow.

fix normal table writting.

* [TD-3607] <fix>: taosdemo buffer overflow.

remove tail spaces.

* [TD-3607] <fix>: taosdemo buffer overflow.

fix taosdemo alter table test case.

* [TD-3607] <fix>: taosdemo buffer overflow.

fix taosdemo alter table case.

* [TD-3607] <fix>: taosdemo buffer overflow.

adjust limit offset count warning.

* [TD-3607] <fix>: taosdemo buffer overflow.

add more logic for child tables exist.

* [TD-3607] <fix>: taosdemo buffer overflow.

create database if database be dropped only.

* [TD-3607] <fix>: fix taosdemo buffer overflow.

adjust limit and offset test cases.

* [TD-3607] <fix>: taosdemo buffer overflow.

adjust sample data test case.

* [TD-3607]<fix>: taosdemo limit and offset.

if limit+offset > count
Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 8e88aab4
...@@ -3527,18 +3527,18 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { ...@@ -3527,18 +3527,18 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
} }
cJSON* childTbl_limit = cJSON_GetObjectItem(stbInfo, "childtable_limit"); cJSON* childTbl_limit = cJSON_GetObjectItem(stbInfo, "childtable_limit");
if (childTbl_limit) { if ((childTbl_limit) && (g_Dbs.db[i].drop != true)) {
if (childTbl_limit->type != cJSON_Number) { if (childTbl_limit->type != cJSON_Number) {
printf("ERROR: failed to read json, childtable_limit\n"); printf("ERROR: failed to read json, childtable_limit\n");
goto PARSE_OVER; goto PARSE_OVER;
} }
g_Dbs.db[i].superTbls[j].childTblLimit = childTbl_limit->valueint; g_Dbs.db[i].superTbls[j].childTblLimit = childTbl_limit->valueint;
} else { } else {
g_Dbs.db[i].superTbls[j].childTblLimit = -1; // select ... limit -1 means all query result g_Dbs.db[i].superTbls[j].childTblLimit = -1; // select ... limit -1 means all query result, drop = yes mean all table need recreate, limit value is invalid.
} }
cJSON* childTbl_offset = cJSON_GetObjectItem(stbInfo, "childtable_offset"); cJSON* childTbl_offset = cJSON_GetObjectItem(stbInfo, "childtable_offset");
if (childTbl_offset) { if ((childTbl_offset) && (g_Dbs.db[i].drop != true)) {
if (childTbl_offset->type != cJSON_Number || 0 > childTbl_offset->valueint) { if (childTbl_offset->type != cJSON_Number || 0 > childTbl_offset->valueint) {
printf("ERROR: failed to read json, childtable_offset\n"); printf("ERROR: failed to read json, childtable_offset\n");
goto PARSE_OVER; goto PARSE_OVER;
...@@ -5170,7 +5170,9 @@ static void startMultiThreadInsertData(int threads, char* db_name, ...@@ -5170,7 +5170,9 @@ static void startMultiThreadInsertData(int threads, char* db_name,
if ((superTblInfo->childTblExists == TBL_ALREADY_EXISTS) if ((superTblInfo->childTblExists == TBL_ALREADY_EXISTS)
&& (superTblInfo->childTblOffset >= 0)) { && (superTblInfo->childTblOffset >= 0)) {
if (superTblInfo->childTblLimit < 0) { if ((superTblInfo->childTblLimit < 0)
|| ((superTblInfo->childTblOffset + superTblInfo->childTblLimit)
> (superTblInfo->childTblCount))) {
superTblInfo->childTblLimit = superTblInfo->childTblLimit =
superTblInfo->childTblCount - superTblInfo->childTblOffset; superTblInfo->childTblCount - superTblInfo->childTblOffset;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册