-
Notifications
You must be signed in to change notification settings - Fork 1.5k
stream bulk #9308
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
stream bulk #9308
Conversation
b271d82
to
fe0f67d
Compare
if err == nil { | ||
pDir := filepath.Join(basePath, entry.Name(), "p") | ||
if _, err := os.Stat(pDir); err == nil { | ||
groupDirs[uint32(groupID)] = pDir |
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
To fix the problem, we need to ensure that the integer value obtained from strconv.Atoi
is within the bounds of the uint32
type before performing the conversion. This can be done by adding a check to ensure the value is non-negative and does not exceed the maximum value of uint32
.
The best way to fix this is to use strconv.ParseUint
with a bit size of 32, which directly parses the string into a uint32
value, ensuring that the value is within the valid range for uint32
. This approach avoids the need for additional bounds checking.
-
Copy modified line R128
@@ -127,3 +127,3 @@ | ||
if entry.IsDir() { | ||
groupID, err := strconv.Atoi(entry.Name()) | ||
groupID, err := strconv.ParseUint(entry.Name(), 10, 32) | ||
if err == nil { |
|
57ab93a
to
2d973be
Compare
2d973be
to
22fb001
Compare
Description
Please explain the changes you made here.
Checklist
CHANGELOG.md
file describing and linking tothis PR
docs repo staged and linked here
Instructions
syntax, leading with
fix:
,feat:
,chore:
,ci:
, etc.link to the bug.
[x]
syntax.back and check the box later.
Instructions
line and everything below it, to indicate you have read and arefollowing these instructions. 🙂
Thank you for your contribution to Dgraph!