Repository navigation
Guard Go allocation capacities against integer overflow - #65653
Merged
Merged
Conversation
2 tasks
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix CodeQL allocation overflow alerts with safe-capacity helper
Guard Go allocation capacities against integer overflow
Oct 4, 2026
pelikhan
marked this pull request as ready for review
October 4, 2026 20:48
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The schema change breaks supported expression-valued concurrency queue configurations and an existing test.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Hardens Go allocation capacity calculations against integer overflow using the shared typeutil helper.
Changes:
- Applies checked arithmetic to combined capacity hints.
- Removes selected input-sized preallocations.
- Incidentally restricts expression-valued concurrency queues.
| File | Description |
|---|---|
pkg/workflow/schemas/github-workflow.json |
Restricts concurrency queue values. |
pkg/workflow/mcp_setup_generator.go |
Safely sizes copied tool maps. |
pkg/workflow/mcp_github_config.go |
Hardens or removes capacity hints. |
pkg/workflow/mcp_cli_mount.go |
Safely sizes prompt lines. |
pkg/workflow/create_code_scanning_alert.go |
Safely combines upload steps. |
pkg/workflow/compiler_yaml_ai_execution.go |
Safely sizes injected execution steps. |
pkg/cli/experiments_command.go |
Removes experiment-result preallocation. |
Comment on lines
+45
to
+46
| "type": "string", | ||
| "enum": ["single", "max"], |
Contributor
|
🎉 This pull request is included in a new release. Release: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Allocation-size overflow alerts recur where input-derived lengths are combined for slice or map capacity. Use checked capacity arithmetic for those sums and avoid explicit input-sized preallocation at flagged call sites.
typeutil.SafeAllocationCapacity.MaxInt, overflow, and negative inputs.