-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Issue
In task/create.go:81-92, the filename uniqueness check has no upper limit.
for i := 1; ; i++ { // ← No break condition!
if _, err := os.Stat(filePath); os.IsNotExist(err) {
break
}
// Increments forever if all filenames are taken
}Problem
- If thousands of files with same name exist, loop never terminates
- No safeguard against edge case
- Can hang application
Solution
Add a reasonable limit:
const maxDuplicateAttempts = 100
for i := 1; i <= maxDuplicateAttempts; i++ {
if _, err := os.Stat(filePath); os.IsNotExist(err) {
break
}
}
if i > maxDuplicateAttempts {
return "", "", fmt.Errorf("too many duplicate filenames")
}Impact
🟡 Medium - Unlikely edge case but dangerous
Metadata
Metadata
Assignees
Labels
No labels