Check for integer overflow in Block::Iter::ParseNextKey.

This commit is contained in:
Christopher Jeffrey 2022-06-18 11:06:42 -04:00
parent d328a35b5c
commit 294330e8e5
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -268,7 +268,8 @@ class Block::Iter : public Iterator {
uint32_t shared, non_shared, value_length;
p = DecodeEntry(p, limit, &shared, &non_shared, &value_length);
if (p == nullptr || key_.size() < shared ||
(comparator_->IsInternal() && shared + non_shared < 8)) {
(comparator_->IsInternal() &&
static_cast<uint64_t>(shared) + non_shared < 8)) {
CorruptionError();
return false;
} else {