From 7de713619f84c7708737eb119735a500e03167d7 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 12 Jun 2026 18:31:51 +0000 Subject: object/store/packed: Use the new MaxChainDepth --- object/store/packed/delta.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'object') diff --git a/object/store/packed/delta.go b/object/store/packed/delta.go index c52bd10a..c20a3eb5 100644 --- a/object/store/packed/delta.go +++ b/object/store/packed/delta.go @@ -12,10 +12,6 @@ import ( "lindenii.org/go/furgit/internal/format/packfile/delta" ) -// maxDeltaDepth bounds delta chain length, -// guaranteeing termination on crafted ref-delta loops. -const maxDeltaDepth = 1 << 12 - // deltaNode is a delta entry on a resolution chain. type deltaNode struct { // payload is the entry's compressed delta payload view. @@ -55,7 +51,7 @@ func (packed *Packed) unpackEntry(p *pack, offset uint64) (packfile.EntryType, [ break } - if len(chain) >= maxDeltaDepth { + if len(chain) >= delta.MaxChainDepth { return zero, nil, fmt.Errorf("%w: pack %q: delta chain too deep", ErrMalformedPackedStore, p.name) } @@ -176,7 +172,7 @@ func (packed *Packed) resolveType(p *pack, offset uint64, entryHeader packfile.E } depth++ - if depth > maxDeltaDepth { + if depth > delta.MaxChainDepth { return zero, fmt.Errorf("%w: pack %q: delta chain too deep", ErrMalformedPackedStore, p.name) } -- cgit v1.3.1-10-gc9f91