Skip to content

fix(diff): avoid input-derived Myers allocation arithmetic#3777

Merged
esengine merged 1 commit into
esengine:main-v2from
SivanCola:codex/fix-diff-allocation-arithmetic
Jun 10, 2026
Merged

fix(diff): avoid input-derived Myers allocation arithmetic#3777
esengine merged 1 commit into
esengine:main-v2from
SivanCola:codex/fix-diff-allocation-arithmetic

Conversation

@SivanCola

@SivanCola SivanCola commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Testing

  • go test ./internal/diff/
  • go test ./... fails in internal/control: TestRemoveMCPServerRemovesUnconnectedLazyPlaceholder sees locally configured MCP names instead of an empty config.

@SivanCola SivanCola requested a review from esengine as a code owner June 10, 2026 04:00
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 10, 2026
@SivanCola SivanCola force-pushed the codex/fix-diff-allocation-arithmetic branch from 9a6677b to 32de0f1 Compare June 10, 2026 04:02

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nice — this is the approach that actually satisfies the analyzer. By computing min(n+m, maxDiffEdits) and 2*maxD+1 with bounded loops instead of arithmetic on the input lengths, there's no input-derived +/* flowing into the allocation at all, so CodeQL's go/allocation-size-overflow has nothing left to flag — which my earlier clamp couldn't achieve. Both loops are O(maxDiffEdits) and run once per diff, so the cost is nil, and the TestMyersMaxD_CapsWithoutOverflow cases (incl. maxInt) pin the bound. Merging.

@esengine esengine merged commit 7377f46 into esengine:main-v2 Jun 10, 2026
14 checks passed
SuMuxi66 pushed a commit to SuMuxi66/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants