mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 07:20:49 +00:00
MemBlockInfo: Fix potential out-of-bounds in the slab map, reported by Nemoumbra
This commit is contained in:
parent
859e124f1a
commit
2f1389233e
@ -288,7 +288,12 @@ void MemSlabMap::Clear() {
|
||||
|
||||
MemSlabMap::Slab *MemSlabMap::FindSlab(uint32_t addr) {
|
||||
// Jump ahead using our index.
|
||||
Slab *slab = heads_[addr / SLICE_SIZE];
|
||||
size_t slabIndex = addr / SLICE_SIZE;
|
||||
if (slabIndex >= heads_.size()) {
|
||||
// Shouldn't happen, but apparently can.
|
||||
return nullptr;
|
||||
}
|
||||
Slab *slab = heads_[slabIndex];
|
||||
// We often move forward, so check the last find.
|
||||
if (lastFind_->start > slab->start && lastFind_->start <= addr)
|
||||
slab = lastFind_;
|
||||
|
Loading…
Reference in New Issue
Block a user