From d84ab334602ae40b134177db53e71f83be062dc5 Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Fri, 26 Nov 2021 13:33:13 -0500 Subject: [PATCH] GP-0: More test fixes. --- .../ghidra/generic/util/datastruct/SemisparseByteArray.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/generic/util/datastruct/SemisparseByteArray.java b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/generic/util/datastruct/SemisparseByteArray.java index 16264075b2..c9ac44561f 100644 --- a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/generic/util/datastruct/SemisparseByteArray.java +++ b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/generic/util/datastruct/SemisparseByteArray.java @@ -212,10 +212,13 @@ public class SemisparseByteArray { */ public synchronized void putData(final long loc, final byte[] data, final int offset, final int length) { + if (length == 0) { + return; + } if (length < 0) { throw new IllegalArgumentException("length: " + length); } - if (Long.compareUnsigned(loc + length, loc) < 0) { + if (Long.compareUnsigned(loc + length - 1, loc) < 0) { throw new IndexOutOfBoundsException("given offset and length would exceed ULONG_MAX"); } UnsignedLong uLoc = UnsignedLong.fromLongBits(loc);