From 6f25c6e862cbe947ebea4afda170e7be3cbffc87 Mon Sep 17 00:00:00 2001 From: ghorsington Date: Tue, 5 Jan 2021 22:48:40 +0200 Subject: [PATCH] Fix bounds check in PageAllocator.Free --- BepInEx.IL2CPP/Hook/Allocator/PageAllocator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BepInEx.IL2CPP/Hook/Allocator/PageAllocator.cs b/BepInEx.IL2CPP/Hook/Allocator/PageAllocator.cs index 59fb28a..a008adc 100644 --- a/BepInEx.IL2CPP/Hook/Allocator/PageAllocator.cs +++ b/BepInEx.IL2CPP/Hook/Allocator/PageAllocator.cs @@ -92,7 +92,7 @@ namespace BepInEx.IL2CPP.Hook.Allocator foreach (var allocatedChunk in allocatedChunks) { long index = (page - allocatedChunk.BaseAddress) / PAGE_SIZE; - if (index < 0 || index > PAGES_PER_UNIT) + if (index < 0 || index >= PAGES_PER_UNIT) continue; allocatedChunk.Pages[index] = false; return;