Skip to content

Fix IndexError in udiff find_diffs on a +++ header with no --- line#5369

Draft
ikatyal2110 wants to merge 1 commit into
Aider-AI:mainfrom
ikatyal2110:fix-udiff-indexerror-plus-header
Draft

Fix IndexError in udiff find_diffs on a +++ header with no --- line#5369
ikatyal2110 wants to merge 1 commit into
Aider-AI:mainfrom
ikatyal2110:fix-udiff-indexerror-plus-header

Conversation

@ikatyal2110

Copy link
Copy Markdown

find_diffs crashed with IndexError on a malformed unified diff where a '+++ ' line isn't preceded by a '--- ' line — it indexed hunk[-2]/hunk[-3] on a one-element hunk. Added length guards so it parses without crashing and the normal malformed-edit retry can kick in instead. Added a test.

… line

A unified diff whose "+++ " line isn't preceded by a "--- " line (a common
shape for malformed model output) indexed hunk[-2]/hunk[-3] on a short hunk
and raised IndexError, crashing instead of letting the malformed-edit retry
path handle it. Guard the indexing with length checks.
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.

2 participants