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/rev_write.go | |
| parent | objectid, format/pack/ingest: Pack hash ID in algo (diff) | |
| signature | No signature | |
*: Fix overflows
Diffstat (limited to 'format/pack/ingest/rev_write.go')
| -rw-r--r-- | format/pack/ingest/rev_write.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/format/pack/ingest/rev_write.go b/format/pack/ingest/rev_write.go index afa9b4a9..8d30474a 100644 --- a/format/pack/ingest/rev_write.go +++ b/format/pack/ingest/rev_write.go @@ -3,6 +3,8 @@ package ingest import ( "encoding/binary" "slices" + + "codeberg.org/lindenii/furgit/internal/intconv" ) const ( @@ -53,9 +55,14 @@ func writeRev(state *ingestState) error { } for _, recordIdx := range packOrder { - binary.BigEndian.PutUint32(scratch[:4], uint32(recordToIdxPos[recordIdx])) + recordPos, err := intconv.IntToUint32(recordToIdxPos[recordIdx]) + if err != nil { + return err + } + + binary.BigEndian.PutUint32(scratch[:4], recordPos) - err := writeAndHash(state.revFile, hashImpl, scratch[:4]) + err = writeAndHash(state.revFile, hashImpl, scratch[:4]) if err != nil { return err } |
