-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
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
enh: first submit for ci case fixed
fix: use nmake to build windows
fix: hostname can not set default value
// 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
Show autofix suggestion
Hide autofix suggestion
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.
-
Copy modified line R1353
@@ -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); |
No description provided.