Skip to content

Commit

Permalink
Fix VerifyValueChecksum checks (#1138)
Browse files Browse the repository at this point in the history
Fixes #1127 

The issue was that the crc32 value read from log was included when
recomputing hash value for verification.

(cherry picked from commit e28642f)
  • Loading branch information
tuesmiddt authored and Ibrahim Jarif committed Mar 12, 2020
1 parent 7539f0a commit 28a2df3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion value.go
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ func (vlog *valueLog) Read(vp valuePointer, s *y.Slice) ([]byte, func(), error)

if vlog.opt.VerifyValueChecksum {
hash := crc32.New(y.CastagnoliCrcTable)
if _, err := hash.Write(buf); err != nil {
if _, err := hash.Write(buf[:len(buf)-crc32.Size]); err != nil {
runCallback(cb)
return nil, nil, errors.Wrapf(err, "failed to write hash for vp %+v", vp)
}
Expand Down

0 comments on commit 28a2df3

Please sign in to comment.