Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taos-tools 3.0 branch to main #808

Merged
merged 67 commits into from
Oct 17, 2024
Merged

taos-tools 3.0 branch to main #808

merged 67 commits into from
Oct 17, 2024

Conversation

DuanKuanJun
Copy link
Contributor

No description provided.

DuanKuanJun and others added 30 commits September 26, 2024 21:02
feat: taos-tools first submit code support stmt2
fix: stmt with stbInfo incorrect
fix: interlace mode call many time stmt2_bind_param
fix: searchBArray tags with strcasecmp replace strcmp
// calc total size
int32_t tableSize = sizeof(char *) + sizeof(TAOS_STMT2_BIND *) + sizeof(TAOS_STMT2_BIND *) +
sizeof(TAOS_STMT2_BIND) * tagCnt + sizeof(TAOS_STMT2_BIND) * colCnt;
int32_t size = sizeof(TAOS_STMT2_BINDV) + tableSize * capacity;

Check failure

Code scanning / CodeQL

Multiplication result converted to larger type High

Multiplication result may overflow 'int' before it is converted to 'unsigned long'.

Copilot Autofix AI 7 days ago

To fix the problem, we need to ensure that the multiplication is performed using a larger integer type to prevent overflow. This can be achieved by casting one of the operands to a larger type, such as int64_t, before performing the multiplication. This way, the multiplication will be done using 64-bit integers, and the result will be safely stored in the int32_t variable.

Specifically, we will cast tableSize to int64_t before multiplying it by capacity on line 1353. This change will ensure that the multiplication is performed using 64-bit integers, preventing overflow.

Suggested changeset 1
src/benchUtil.c

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/benchUtil.c b/src/benchUtil.c
--- a/src/benchUtil.c
+++ b/src/benchUtil.c
@@ -1352,3 +1352,3 @@
                         sizeof(TAOS_STMT2_BIND) * tagCnt + sizeof(TAOS_STMT2_BIND) * colCnt;
-    int32_t size = sizeof(TAOS_STMT2_BINDV) + tableSize * capacity;
+    int32_t size = sizeof(TAOS_STMT2_BINDV) + (int64_t)tableSize * capacity;
     TAOS_STMT2_BINDV *bindv = benchCalloc(1, size, false);
EOF
@@ -1352,3 +1352,3 @@
sizeof(TAOS_STMT2_BIND) * tagCnt + sizeof(TAOS_STMT2_BIND) * colCnt;
int32_t size = sizeof(TAOS_STMT2_BINDV) + tableSize * capacity;
int32_t size = sizeof(TAOS_STMT2_BINDV) + (int64_t)tableSize * capacity;
TAOS_STMT2_BINDV *bindv = benchCalloc(1, size, false);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Unable to commit as this autofix suggestion is now outdated
@DuanKuanJun DuanKuanJun merged commit 5a7814f into main Oct 17, 2024
19 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants