Skip to content

Commit

Permalink
db: don't pass invalid argument to Uint32N
Browse files Browse the repository at this point in the history
Fixes #4021
  • Loading branch information
RaduBerinde committed Oct 9, 2024
1 parent 6e41e55 commit eb01a00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,8 +817,10 @@ func (i *Iterator) maybeSampleRead() {
// every newly-opened iterator, but we do want to sample some of them.
if !i.readSampling.initialSamplePassed {
i.readSampling.initialSamplePassed = true
if rand.Uint32N(uint32(i.readSampling.bytesUntilReadSampling)) > uint32(bytesRead) {
continue
if i.readSampling.bytesUntilReadSampling > bytesRead {
if rand.Uint64N(i.readSampling.bytesUntilReadSampling) > bytesRead {
continue
}
}
}
i.sampleRead()
Expand Down

0 comments on commit eb01a00

Please sign in to comment.