base-hw: add explicit array-bounds check
This patch rules out out-of-bounds array accesses without inspecting the caller. It is not a bug fix but adds clarity.
This commit is contained in:
parent
de764d8490
commit
beb8bf498c
|
@ -422,6 +422,9 @@ class Hw::Page_table
|
||||||
size_t const size, Page_flags const & flags,
|
size_t const size, Page_flags const & flags,
|
||||||
Allocator & alloc)
|
Allocator & alloc)
|
||||||
{
|
{
|
||||||
|
if (i > MAX_INDEX)
|
||||||
|
return;
|
||||||
|
|
||||||
using Pt = Page_table_level_2;
|
using Pt = Page_table_level_2;
|
||||||
using Ptd = Page_table_descriptor;
|
using Ptd = Page_table_descriptor;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue