From 3bcabfbf7804491518009e636cda79f87d4e8d5c Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 18 Apr 2021 18:48:55 +0200 Subject: [PATCH] fixed mmu bounds check for read --- riscemu/Executable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscemu/Executable.py b/riscemu/Executable.py index 9597a6a..4c9ff78 100644 --- a/riscemu/Executable.py +++ b/riscemu/Executable.py @@ -144,7 +144,7 @@ class LoadedMemorySection: def read(self, offset: int, size: int): if offset < 0: raise MemoryAccessException('Invalid offset {}'.format(offset), self.base + offset, size, 'read') - if offset + size >= self.size: + if offset + size > self.size: raise MemoryAccessException('Outside section boundary of section {}'.format(self.name), self.base + offset, size, 'read') return self.content[offset: offset + size]