Skip to content

fix(amazonq): switch to ulong to avoid overflow when input is larger than 2gb #5558

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

Merged
merged 6 commits into from
Apr 17, 2025

Conversation

rli
Copy link
Contributor

@rli rli commented Apr 10, 2025

2GB in bytes > INT_MAX
so use ULong, which can handle 18 PB

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

…than 2gb

2GB in bytes > INT_MAX
so use ULong, which can handle 18 PB
Copy link

github-actions bot commented Apr 10, 2025

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@rli rli marked this pull request as ready for review April 15, 2025 22:06
@rli rli requested review from a team as code owners April 15, 2025 22:06
@@ -353,5 +301,58 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En

companion object {
private val logger = getLogger<ProjectContextProvider>()
private val regex = Regex("""bin|build|node_modules|venv|\.venv|env|\.idea|\.conda""", RegexOption.IGNORE_CASE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but do we want to move this list to a common utils file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everyone seems to have a different concept of what to ignore at the moment

}
if (file.isFile) {
allFiles.add(file)
return false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

files have no children to visit so it could go either way

@rli rli merged commit fca5e2f into main Apr 17, 2025
16 of 18 checks passed
@rli rli deleted the rli/index-overflow branch April 17, 2025 22:47
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.

3 participants