mirror of
https://github.com/google/leveldb.git
synced 2025-02-04 07:10:10 +08:00
Avoid integer overflow in DecodeEntry.
This commit is contained in:
parent
be8d520965
commit
ab065d80c0
@ -68,7 +68,8 @@ static inline const char* DecodeEntry(const char* p, const char* limit,
|
||||
if ((p = GetVarint32Ptr(p, limit, value_length)) == nullptr) return nullptr;
|
||||
}
|
||||
|
||||
if (static_cast<uint32_t>(limit - p) < (*non_shared + *value_length)) {
|
||||
if (static_cast<uint64_t>(limit - p) <
|
||||
(static_cast<uint64_t>(*non_shared) + *value_length)) {
|
||||
return nullptr;
|
||||
}
|
||||
return p;
|
||||
|
Loading…
Reference in New Issue
Block a user