Ghidra is a software reverse engineering (SRE) framework
GP-0 fix bounds checking
dev747368bd4f5b96f2d0
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/StaticValueByteProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/StaticValueByteProvider.javaindex d7921c54cf..c26de6c493 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/StaticValueByteProvider.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/StaticValueByteProvider.java@@ -15,7 +15,8 @@*/package ghidra.app.util.bin;-import java.io.*;+import java.io.File;+import java.io.IOException;import java.util.Arrays;import ghidra.formats.gfilesystem.FSRL;@@ -67,12 +68,6 @@ public class StaticValueByteProvider implements ByteProvider {return fsrl != null ? fsrl.getPath() : "";}- @Override- public InputStream getInputStream(long index) throws IOException {- assertValidIndex(index, true);- return new ByteProviderInputStream(this, index);- }-@Overridepublic long length() {return length;@@ -98,12 +93,12 @@ public class StaticValueByteProvider implements ByteProvider {}@Override- public byte[] readBytes(long index, long length) throws IOException {+ public byte[] readBytes(long index, long readLength) throws IOException {assertValidIndex(index, true);- if (index + length > length) {+ if (index + readLength > length) {throw new IOException("Attempt to read beyond end of byte data");}- byte[] destBytes = new byte[(int) length];+ byte[] destBytes = new byte[(int) readLength];Arrays.fill(destBytes, value);return destBytes;}