summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/src/BitMapMgr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/src/BitMapMgr.cc')
-rw-r--r--src/kernel/src/BitMapMgr.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/kernel/src/BitMapMgr.cc b/src/kernel/src/BitMapMgr.cc
index 76a6a42f..56c261c2 100644
--- a/src/kernel/src/BitMapMgr.cc
+++ b/src/kernel/src/BitMapMgr.cc
@@ -127,12 +127,14 @@ namespace HAL {
}
UIntPtr raw_base = reinterpret_cast<UIntPtr>(base);
- UIntPtr offset = (ptr_bit_set[kBitMapMagIdx] != kBitMapMagic)
- ? (size + pad)
- : ptr_bit_set[kBitMapSizeIdx];
+
+ if (ptr_bit_set[kBitMapSizeIdx] > kBitMapMaxSz) return nullptr;
+
+ UIntPtr offset = (ptr_bit_set[kBitMapMagIdx] != kBitMapMagic)
+ ? (size + pad)
+ : ptr_bit_set[kBitMapSizeIdx];
base = reinterpret_cast<VoidPtr>(raw_base + offset);
- if (base == nullptr) return nullptr;
}
return nullptr;