diff options
| author | 2026-06-12 18:31:51 +0000 | |
|---|---|---|
| committer | 2026-06-12 18:31:51 +0000 | |
| commit | 7de713619f84c7708737eb119735a500e03167d7 (patch) | |
| tree | 984179face5e27f41ae01dd4cdbb729ac1937f3f /object | |
| parent | internal/format/packfile/delta: Add MaxChainDepth (diff) | |
object/store/packed: Use the new MaxChainDepth
Diffstat (limited to 'object')
| -rw-r--r-- | object/store/packed/delta.go | 8 |
1 files changed, 2 insertions, 6 deletions
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) } |
