diff options
| author | 2026-06-11 13:50:28 +0000 | |
|---|---|---|
| committer | 2026-06-11 13:50:28 +0000 | |
| commit | 3c5bf9fef759d3e736df57f78ed70ccd83de2b51 (patch) | |
| tree | 15d402dd5169e91c5204eaad5331a39ef2e01394 /internal/format | |
| parent | internal/format/packidx: Add basic writing support (diff) | |
internal/format/packidx: Fix lints
Diffstat (limited to 'internal/format')
| -rw-r--r-- | internal/format/packidx/lookup.go | 2 | ||||
| -rw-r--r-- | internal/format/packidx/packidx.go | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/internal/format/packidx/lookup.go b/internal/format/packidx/lookup.go index 5135a5de..d1293f47 100644 --- a/internal/format/packidx/lookup.go +++ b/internal/format/packidx/lookup.go @@ -53,7 +53,7 @@ func (idx *Packidx) OffsetAt(pos int) (uint64, error) { } slot := raw &^ largeOffsetFlag - if slot >= idx.off64Count { + if uint64(slot) >= idx.off64Count { return 0, fmt.Errorf("%w: 64-bit offset reference out of range", ErrMalformedPackIndex) } diff --git a/internal/format/packidx/packidx.go b/internal/format/packidx/packidx.go index a488279a..ef2c93f4 100644 --- a/internal/format/packidx/packidx.go +++ b/internal/format/packidx/packidx.go @@ -47,7 +47,7 @@ type Packidx struct { off32Off int off64Off int // off64Count is the number of 64-bit offset table entries. - off64Count uint32 + off64Count uint64 } // Parse parses one pack index from data. @@ -75,6 +75,7 @@ func Parse(data []byte, hashSize int) (Packidx, error) { } prev := uint32(0) + for i := range 256 { count := binary.BigEndian.Uint32(data[headerLen+4*i:]) if count < prev { @@ -116,7 +117,7 @@ func Parse(data []byte, hashSize int) (Packidx, error) { idx := Packidx{ data: data, hashSize: hashSize, - off64Count: uint32(off64Count), + off64Count: off64Count, } idx.numObjects, err = intconv.Uint64ToInt(numObjects) |
