-
Notifications
You must be signed in to change notification settings - Fork 15
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
Rework multipart handling without tree service #1087
base: master
Are you sure you want to change the base?
Rework multipart handling without tree service #1087
Conversation
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Closes #1068. Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
maxKeys = 1000 | ||
} | ||
|
||
opts.SetCount(uint32(maxKeys)) |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types High
strconv.Atoi
Copilot Autofix AI 2 days ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
} | ||
|
||
if copies, err := strconv.ParseUint(payloadMap[metaKeyMultipartCopiesNumber], 10, 64); err == nil { | ||
multipartInfo.CopiesNumber = uint32(copies) |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types High
strconv.ParseUint
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 2 days ago
To fix the problem, we need to add an upper bound check to ensure that the value parsed from the string fits within the uint32
range before converting it. This can be done by comparing the parsed uint64
value against the maximum value of uint32
(math.MaxUint32
). If the value exceeds this limit, we should handle it appropriately, such as by returning an error or using a default value.
-
Copy modified line R18 -
Copy modified lines R904-R906
@@ -17,2 +17,3 @@ | ||
"strconv" | ||
"math" | ||
"strings" | ||
@@ -902,2 +903,5 @@ | ||
if copies, err := strconv.ParseUint(payloadMap[metaKeyMultipartCopiesNumber], 10, 64); err == nil { | ||
if copies > math.MaxUint32 { | ||
return data.MultipartInfo{}, fmt.Errorf("copies number exceeds uint32 limit: %d", copies) | ||
} | ||
multipartInfo.CopiesNumber = uint32(copies) |
No description provided.