Skip to content

Commit

Permalink
add assert to check integer overflow for table size (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
poonai authored Jul 10, 2020
1 parent 8e896a7 commit 7f4e4b5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions table/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ func (b *Builder) shouldFinishBlock(key []byte, value y.ValueStruct) bool {
// So, size of IV is added to estimatedSize.
estimatedSize += aes.BlockSize
}
// Integer overflow check for table size.
y.AssertTrue(uint64(b.sz)+uint64(estimatedSize) < math.MaxUint32)

return estimatedSize > uint32(b.opt.BlockSize)
}

Expand Down

0 comments on commit 7f4e4b5

Please sign in to comment.