From cf20d046cab42e80866d8557e1b4ba4d47186300 Mon Sep 17 00:00:00 2001 From: Eric Bruneton Date: Sat, 28 Aug 2021 11:55:18 +0200 Subject: Add an assertion in ByteVector.enlarge(). --- asm/src/main/java/org/objectweb/asm/ByteVector.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'asm/src') diff --git a/asm/src/main/java/org/objectweb/asm/ByteVector.java b/asm/src/main/java/org/objectweb/asm/ByteVector.java index 9db89566..d728a15e 100644 --- a/asm/src/main/java/org/objectweb/asm/ByteVector.java +++ b/asm/src/main/java/org/objectweb/asm/ByteVector.java @@ -352,6 +352,9 @@ public class ByteVector { * @param size number of additional bytes that this byte vector should be able to receive. */ private void enlarge(final int size) { + if (length > data.length) { + throw new AssertionError("Internal error"); + } int doubleCapacity = 2 * data.length; int minimalCapacity = length + size; byte[] newData = new byte[doubleCapacity > minimalCapacity ? doubleCapacity : minimalCapacity]; -- cgit v1.2.3