diff options
| author | 2026-03-05 21:09:07 +0800 | |
|---|---|---|
| committer | 2026-03-05 21:14:24 +0800 | |
| commit | 355f5b3dc9ae560827cd274e113f43d09ee9ac49 (patch) | |
| tree | 2046f5d51110fff82aecf35c75884222f51ac36c /format/pack/ingest/idx_write.go | |
| parent | objectid, format/pack/ingest: Pack hash ID in algo (diff) | |
| signature | No signature | |
*: Fix overflows
Diffstat (limited to 'format/pack/ingest/idx_write.go')
| -rw-r--r-- | format/pack/ingest/idx_write.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/format/pack/ingest/idx_write.go b/format/pack/ingest/idx_write.go index 8db11ba0..904afb6c 100644 --- a/format/pack/ingest/idx_write.go +++ b/format/pack/ingest/idx_write.go @@ -7,6 +7,8 @@ import ( "hash" "io" "slices" + + "codeberg.org/lindenii/furgit/internal/intconv" ) const ( @@ -87,7 +89,12 @@ func writeIdx(state *ingestState) error { for _, recordIdx := range order { offset := state.records[recordIdx].offset if offset >= 0x80000000 { - word := 0x80000000 | uint32(len(largeOffsets)) + largeOffsetIdx, err := intconv.IntToUint32(len(largeOffsets)) + if err != nil { + return err + } + + word := 0x80000000 | largeOffsetIdx largeOffsets = append(largeOffsets, offset) binary.BigEndian.PutUint32(scratch[:4], word) |
