From 7b02384078657fe299278bb4dcec79baad44d2f2 Mon Sep 17 00:00:00 2001 From: larkwiot <22042193+larkwiot@users.noreply.github.com> Date: Thu, 7 Oct 2021 11:10:20 -0400 Subject: [PATCH] Ghidra should not suppress exceptions from scripts Blanket-suppressing exceptions deprives writers of Ghidra Scripts the ability to handle or even see and know about exceptions in their MemoryAccessFilter's --- .../ghidra/app/emulator/FilteredMemoryState.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/FilteredMemoryState.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/FilteredMemoryState.java index 8629ec11fb0..fd106c5db6b 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/FilteredMemoryState.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/emulator/FilteredMemoryState.java @@ -34,12 +34,8 @@ public int getChunk(byte[] res, AddressSpace spc, long off, int size, int readLen = super.getChunk(res, spc, off, size, stopOnUnintialized); if (filterEnabled && filter != null) { filterEnabled = false; - try { - filter.filterRead(spc, off, readLen, res); - } - finally { - filterEnabled = true; - } + filter.filterRead(spc, off, readLen, res); + filterEnabled = true; } return readLen; } @@ -49,12 +45,8 @@ public void setChunk(byte[] res, AddressSpace spc, long off, int size) { super.setChunk(res, spc, off, size); if (filterEnabled && filter != null) { filterEnabled = false; - try { - filter.filterWrite(spc, off, size, res); - } - finally { - filterEnabled = true; - } + filter.filterWrite(spc, off, size, res); + filterEnabled = true; } }