summaryrefslogtreecommitdiff
path: root/asm/src
diff options
context:
space:
mode:
authorEric Bruneton <ebruneton@free.fr>2021-08-28 11:55:18 +0200
committerEric Bruneton <ebruneton@free.fr>2021-08-28 11:55:18 +0200
commitcf20d046cab42e80866d8557e1b4ba4d47186300 (patch)
tree00c28699e50a5fb53a747aafb44d42fcda6ac573 /asm/src
parente45e0a04752e48d306a1b824d6367c6392ba6187 (diff)
downloadow2-asm-cf20d046cab42e80866d8557e1b4ba4d47186300.tar.gz
Add an assertion in ByteVector.enlarge().
Diffstat (limited to 'asm/src')
-rw-r--r--asm/src/main/java/org/objectweb/asm/ByteVector.java3
1 files changed, 3 insertions, 0 deletions
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];