fix(tvix/store/blobservice): write into hasher from b, not buf

buf contains everything written so far, whereas b is the slice passed in
the current write() call. If we copy from &buf, we end up with the wrong
hash, because we keep writing the wrong data to the hash function.

Change-Id: I768d4645934a6a7d75b9c8eeba35f8f3be5edd26
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8880
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2023-06-30 13:50:14 +02:00 committed by clbot
parent f5e291cf83
commit 6604ce4e51
2 changed files with 2 additions and 2 deletions

View file

@ -79,7 +79,7 @@ impl std::io::Write for MemoryBlobWriter {
)),
Some((ref mut buf, ref mut hasher)) => {
let bytes_written = buf.write(b)?;
hasher.write(&buf[..bytes_written])
hasher.write(&b[..bytes_written])
}
}
}

View file

@ -108,7 +108,7 @@ impl io::Write for SledBlobWriter {
)),
Some((ref mut buf, ref mut hasher)) => {
let bytes_written = buf.write(b)?;
hasher.write(&buf[..bytes_written])
hasher.write(&b[..bytes_written])
}
}
}