Skip to content

Ghidra is a software reverse engineering (SRE) framework

GT-2495: Fixing Python Interpreter OutOfMemoryError when reading in large strings longer than 8192 characters.

Ryan Kurtz633049d83bf6
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterPanel.java
index d148b6cf9a..83c114122f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterPanel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterPanel.java
@@ -679,14 +679,14 @@ public class InterpreterPanel extends JPanel implements OptionsChangeListener {
}
if (bytes != null) {
- int length = Math.min(bytes.length, len);
- System.arraycopy(bytes, 0, b, off, length);
- if (length == bytes.length) {
+ int length = Math.min(bytes.length - position, len);
+ System.arraycopy(bytes, position, b, off, length);
+ if (position + length == bytes.length) {
position = 0;
bytes = null;
}
else {
- position = b.length;
+ position += length;
}
return length;
}