Skip to content

plumbing: format/packfile, Test patchDeltaWriter cap#2086

Merged
pjbgf merged 1 commit into
go-git:mainfrom
hiddeco:patchdeltawriter-target-cap
May 8, 2026
Merged

plumbing: format/packfile, Test patchDeltaWriter cap#2086
pjbgf merged 1 commit into
go-git:mainfrom
hiddeco:patchdeltawriter-target-cap

Conversation

@hiddeco

@hiddeco hiddeco commented May 7, 2026

Copy link
Copy Markdown
Member

patchDeltaWriter's preemptive Buffer.Grow is already clamped at maxPatchPreemptionSize since 5b89cb5, but no test covered that path end-to-end. Add a regression test that constructs a delta whose header advertises a math.MaxInt64 targetSz and asserts the call returns an error rather than driving the allocation.

Also restate the rationale for the clamp in the comment, naming both the input-validation goal and the symmetry with patchDelta.

@hiddeco hiddeco force-pushed the patchdeltawriter-target-cap branch 4 times, most recently from b975883 to b0774f2 Compare May 7, 2026 18:23
pjbgf
pjbgf previously approved these changes May 7, 2026

@pjbgf pjbgf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@hiddeco thanks for working on this. 🙇

`patchDeltaWriter`'s preemptive `Buffer.Grow` is already clamped
at `maxPatchPreemptionSize` since `5b89cb5a`, but no test covered
that path end-to-end. Add a regression test that constructs a
delta whose header advertises a `math.MaxInt64` `targetSz` and
asserts the call returns an error rather than driving the
allocation.

Also restate the rationale for the clamp in the comment, naming
both the input-validation goal and the symmetry with `patchDelta`.

Assisted-by: Claude Opus 4.7
Signed-off-by: Hidde Beydals <[email protected]>
@hiddeco hiddeco force-pushed the patchdeltawriter-target-cap branch from b0774f2 to 5d45247 Compare May 8, 2026 06:58
@hiddeco hiddeco changed the title plumbing: format/packfile, Cap target pre-allocation plumbing: format/packfile, Test patchDeltaWriter cap May 8, 2026

@pjbgf pjbgf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@hiddeco thanks for working on this. 🙇

@pjbgf pjbgf merged commit 5d0e1f1 into go-git:main May 8, 2026
21 checks passed
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