From 2f0c90c94545a6f1dabb976fda484bc946168c44 Mon Sep 17 00:00:00 2001 From: Peter Lawrey Date: Wed, 24 Jun 2015 13:58:09 +0100 Subject: [PATCH] Fix a bug in the bounds check for Bytes.zeroOut() --- src/main/java/net/openhft/chronicle/bytes/BytesStore.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/openhft/chronicle/bytes/BytesStore.java b/src/main/java/net/openhft/chronicle/bytes/BytesStore.java index 09d09e6270a..b96496aab8f 100755 --- a/src/main/java/net/openhft/chronicle/bytes/BytesStore.java +++ b/src/main/java/net/openhft/chronicle/bytes/BytesStore.java @@ -112,7 +112,9 @@ default void copyTo(BytesStore store) { } default B zeroOut(long start, long end) { - if (start < start() || end > capacity() || end > start) + if (end <= start) + return (B) this; + if (start < start() || end > capacity()) throw new IllegalArgumentException(); long i = start; for (; i < end - 7; i++)