You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cs...@apache.org on 2025/02/27 23:23:09 UTC
(activemq) branch activemq-5.18.x updated (ea9e6acb11 -> 7781d01fc6)
This is an automated email from the ASF dual-hosted git repository.
cshannon pushed a change to branch activemq-5.18.x
in repository https://gitbox.apache.org/repos/asf/activemq.git
from ea9e6acb11 Fix line endings in openwire generated files
new 3b3a3b2023 AMQ-6596 - Validate size of buffers during unmarshalling
new 7781d01fc6 AMQ-6596 - Add license to test
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
activemq-client/pom.xml | 5 +
.../apache/activemq/openwire/OpenWireFormat.java | 118 +++++++---
.../org/apache/activemq/openwire/OpenWireUtil.java | 51 +++-
.../openwire/v1/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v1/MessageMarshaller.java | 8 +-
.../openwire/v1/PartialCommandMarshaller.java | 4 +-
.../openwire/v1/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v1/XATransactionIdMarshaller.java | 8 +-
.../openwire/v10/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v10/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v10/MessageMarshaller.java | 8 +-
.../openwire/v10/PartialCommandMarshaller.java | 4 +-
.../openwire/v10/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v10/XATransactionIdMarshaller.java | 8 +-
.../openwire/v11/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v11/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v11/MessageMarshaller.java | 8 +-
.../openwire/v11/PartialCommandMarshaller.java | 4 +-
.../openwire/v11/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v11/XATransactionIdMarshaller.java | 8 +-
.../openwire/v12/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v12/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v12/MessageMarshaller.java | 8 +-
.../openwire/v12/PartialCommandMarshaller.java | 4 +-
.../openwire/v12/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v12/XATransactionIdMarshaller.java | 8 +-
.../openwire/v9/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v9/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v9/MessageMarshaller.java | 8 +-
.../openwire/v9/PartialCommandMarshaller.java | 4 +-
.../openwire/v9/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v9/XATransactionIdMarshaller.java | 8 +-
.../apache/activemq/util/IOExceptionSupport.java | 8 +-
.../apache/activemq/openwire/OpenWireUtilTest.java | 119 ++++++++++
.../activemq/openwire/OpenWireValidationTest.java | 261 +++++++++++++++++++--
activemq-openwire-legacy/pom.xml | 5 +
.../openwire/v2/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v2/MessageMarshaller.java | 8 +-
.../openwire/v2/PartialCommandMarshaller.java | 4 +-
.../openwire/v2/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v2/XATransactionIdMarshaller.java | 8 +-
.../openwire/v3/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v3/MessageMarshaller.java | 8 +-
.../openwire/v3/PartialCommandMarshaller.java | 4 +-
.../openwire/v3/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v3/XATransactionIdMarshaller.java | 8 +-
.../openwire/v4/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v4/MessageMarshaller.java | 8 +-
.../openwire/v4/PartialCommandMarshaller.java | 4 +-
.../openwire/v4/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v4/XATransactionIdMarshaller.java | 8 +-
.../openwire/v5/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v5/MessageMarshaller.java | 8 +-
.../openwire/v5/PartialCommandMarshaller.java | 4 +-
.../openwire/v5/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v5/XATransactionIdMarshaller.java | 8 +-
.../openwire/v6/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v6/MessageMarshaller.java | 8 +-
.../openwire/v6/PartialCommandMarshaller.java | 4 +-
.../openwire/v6/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v6/XATransactionIdMarshaller.java | 8 +-
.../openwire/v7/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v7/MessageMarshaller.java | 8 +-
.../openwire/v7/PartialCommandMarshaller.java | 4 +-
.../openwire/v7/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v7/XATransactionIdMarshaller.java | 8 +-
.../openwire/v8/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v8/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v8/MessageMarshaller.java | 8 +-
.../openwire/v8/PartialCommandMarshaller.java | 4 +-
.../openwire/v8/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v8/XATransactionIdMarshaller.java | 8 +-
.../openwire/OpenWireLegacyValidationTest.java | 46 +++-
pom.xml | 6 +
74 files changed, 812 insertions(+), 259 deletions(-)
create mode 100644 activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireUtilTest.java
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
(activemq) 02/02: AMQ-6596 - Add license to test
Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cshannon pushed a commit to branch activemq-5.18.x
in repository https://gitbox.apache.org/repos/asf/activemq.git
commit 7781d01fc6ddcea6f643e1e8c9c44009ac4f130f
Author: Christopher L. Shannon <cs...@apache.org>
AuthorDate: Thu Feb 27 09:05:51 2025 -0500
AMQ-6596 - Add license to test
(cherry picked from commit ff6dc101695b83d507be507b380e00c866e76bf6)
(cherry picked from commit 3fd9f41f47bef98f366690633caae93d306b4d69)
---
.../org/apache/activemq/openwire/OpenWireUtilTest.java | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireUtilTest.java b/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireUtilTest.java
index 93b12ee451..e26d09a43e 100644
--- a/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireUtilTest.java
+++ b/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireUtilTest.java
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.activemq.openwire;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
(activemq) 01/02: AMQ-6596 - Validate size of buffers during unmarshalling
Posted by cs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cshannon pushed a commit to branch activemq-5.18.x
in repository https://gitbox.apache.org/repos/asf/activemq.git
commit 3b3a3b2023ac811f27e9219adff2010e34c85cd5
Author: Christopher L. Shannon <cs...@apache.org>
AuthorDate: Fri Jan 31 19:56:17 2025 -0500
AMQ-6596 - Validate size of buffers during unmarshalling
Verify that size buffers for arrays and bytesequences will not exceed
the overall frame size
(cherry picked from commit 3037ce8b3b6a1efd67d273ad0bb6590c0434fad1)
(cherry picked from commit 31c4d28ccaa5c88a15fc5fc876a4c6d6ddd5b719)
---
activemq-client/pom.xml | 5 +
.../apache/activemq/openwire/OpenWireFormat.java | 118 +++++++---
.../org/apache/activemq/openwire/OpenWireUtil.java | 51 +++-
.../openwire/v1/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v1/MessageMarshaller.java | 8 +-
.../openwire/v1/PartialCommandMarshaller.java | 4 +-
.../openwire/v1/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v1/XATransactionIdMarshaller.java | 8 +-
.../openwire/v10/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v10/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v10/MessageMarshaller.java | 8 +-
.../openwire/v10/PartialCommandMarshaller.java | 4 +-
.../openwire/v10/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v10/XATransactionIdMarshaller.java | 8 +-
.../openwire/v11/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v11/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v11/MessageMarshaller.java | 8 +-
.../openwire/v11/PartialCommandMarshaller.java | 4 +-
.../openwire/v11/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v11/XATransactionIdMarshaller.java | 8 +-
.../openwire/v12/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v12/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v12/MessageMarshaller.java | 8 +-
.../openwire/v12/PartialCommandMarshaller.java | 4 +-
.../openwire/v12/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v12/XATransactionIdMarshaller.java | 8 +-
.../openwire/v9/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v9/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v9/MessageMarshaller.java | 8 +-
.../openwire/v9/PartialCommandMarshaller.java | 4 +-
.../openwire/v9/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v9/XATransactionIdMarshaller.java | 8 +-
.../apache/activemq/util/IOExceptionSupport.java | 8 +-
.../apache/activemq/openwire/OpenWireUtilTest.java | 103 ++++++++
.../activemq/openwire/OpenWireValidationTest.java | 261 +++++++++++++++++++--
activemq-openwire-legacy/pom.xml | 5 +
.../openwire/v2/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v2/MessageMarshaller.java | 8 +-
.../openwire/v2/PartialCommandMarshaller.java | 4 +-
.../openwire/v2/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v2/XATransactionIdMarshaller.java | 8 +-
.../openwire/v3/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v3/MessageMarshaller.java | 8 +-
.../openwire/v3/PartialCommandMarshaller.java | 4 +-
.../openwire/v3/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v3/XATransactionIdMarshaller.java | 8 +-
.../openwire/v4/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v4/MessageMarshaller.java | 8 +-
.../openwire/v4/PartialCommandMarshaller.java | 4 +-
.../openwire/v4/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v4/XATransactionIdMarshaller.java | 8 +-
.../openwire/v5/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v5/MessageMarshaller.java | 8 +-
.../openwire/v5/PartialCommandMarshaller.java | 4 +-
.../openwire/v5/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v5/XATransactionIdMarshaller.java | 8 +-
.../openwire/v6/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v6/MessageMarshaller.java | 8 +-
.../openwire/v6/PartialCommandMarshaller.java | 4 +-
.../openwire/v6/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v6/XATransactionIdMarshaller.java | 8 +-
.../openwire/v7/BaseDataStreamMarshaller.java | 12 +-
.../activemq/openwire/v7/MessageMarshaller.java | 8 +-
.../openwire/v7/PartialCommandMarshaller.java | 4 +-
.../openwire/v7/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v7/XATransactionIdMarshaller.java | 8 +-
.../openwire/v8/BaseDataStreamMarshaller.java | 12 +-
.../openwire/v8/ConnectionControlMarshaller.java | 4 +-
.../activemq/openwire/v8/MessageMarshaller.java | 8 +-
.../openwire/v8/PartialCommandMarshaller.java | 4 +-
.../openwire/v8/WireFormatInfoMarshaller.java | 4 +-
.../openwire/v8/XATransactionIdMarshaller.java | 8 +-
.../openwire/OpenWireLegacyValidationTest.java | 46 +++-
pom.xml | 6 +
74 files changed, 796 insertions(+), 259 deletions(-)
diff --git a/activemq-client/pom.xml b/activemq-client/pom.xml
index 56da43368f..d051007ea9 100644
--- a/activemq-client/pom.xml
+++ b/activemq-client/pom.xml
@@ -79,6 +79,11 @@
<artifactId>log4j-slf4j2-impl</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java b/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
index f1ec271f84..8914d3c96f 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java
@@ -48,7 +48,7 @@ public final class OpenWireFormat implements WireFormat {
private static final int MARSHAL_CACHE_SIZE = Short.MAX_VALUE / 2;
private static final int MARSHAL_CACHE_FREE_SPACE = 100;
- private DataStreamMarshaller dataMarshallers[];
+ private DataStreamMarshaller[] dataMarshallers;
private int version;
private boolean stackTraceEnabled;
private boolean tcpNoDelayEnabled;
@@ -61,13 +61,22 @@ public final class OpenWireFormat implements WireFormat {
// The following fields are used for value caching
private short nextMarshallCacheIndex;
private short nextMarshallCacheEvictionIndex;
- private Map<DataStructure, Short> marshallCacheMap = new HashMap<DataStructure, Short>();
+ private Map<DataStructure, Short> marshallCacheMap = new HashMap<>();
private DataStructure marshallCache[] = null;
private DataStructure unmarshallCache[] = null;
- private DataByteArrayOutputStream bytesOut = new DataByteArrayOutputStream();
- private DataByteArrayInputStream bytesIn = new DataByteArrayInputStream();
+ private final DataByteArrayOutputStream bytesOut = new DataByteArrayOutputStream();
+ private final DataByteArrayInputStream bytesIn = new DataByteArrayInputStream();
private WireFormatInfo preferedWireFormatInfo;
+ // Used to track the currentFrameSize for validation during unmarshalling
+ // Ideally we would pass the MarshallingContext directly to the marshalling methods,
+ // however this would require modifying the DataStreamMarshaller interface which would result
+ // in hundreds of existing methods having to be updated so this allows avoiding that and
+ // tracking the state without breaking the existing API.
+ // Note that while this is currently only used during unmarshalling, but if necessary could
+ // be extended in the future to be used during marshalling as well.
+ private final ThreadLocal<MarshallingContext> marshallingContext = new ThreadLocal<>();
+
public OpenWireFormat() {
this(DEFAULT_STORE_VERSION);
}
@@ -191,26 +200,23 @@ public final class OpenWireFormat implements WireFormat {
@Override
public synchronized Object unmarshal(ByteSequence sequence) throws IOException {
bytesIn.restart(sequence);
- // DataInputStream dis = new DataInputStream(new
- // ByteArrayInputStream(sequence));
-
- if (!sizePrefixDisabled) {
- int size = bytesIn.readInt();
- if (sequence.getLength() - 4 != size) {
- // throw new IOException("Packet size does not match marshaled
- // size");
- }
- if (maxFrameSizeEnabled && size > maxFrameSize) {
- throw IOExceptionSupport.createFrameSizeException(size, maxFrameSize);
+ try {
+ final var context = new MarshallingContext();
+ marshallingContext.set(context);
+
+ if (!sizePrefixDisabled) {
+ int size = bytesIn.readInt();
+ if (maxFrameSizeEnabled && size > maxFrameSize) {
+ throw IOExceptionSupport.createFrameSizeException(size, maxFrameSize);
+ }
+ context.setFrameSize(size);
}
+ return doUnmarshal(bytesIn);
+ } finally {
+ // After we unmarshal we can clear the context
+ marshallingContext.remove();
}
-
- Object command = doUnmarshal(bytesIn);
- // if( !cacheEnabled && ((DataStructure)command).isMarshallAware() ) {
- // ((MarshallAware) command).setCachedMarshalledForm(this, sequence);
- // }
- return command;
}
@Override
@@ -275,19 +281,22 @@ public final class OpenWireFormat implements WireFormat {
@Override
public Object unmarshal(DataInput dis) throws IOException {
- DataInput dataIn = dis;
- if (!sizePrefixDisabled) {
- int size = dis.readInt();
- if (maxFrameSizeEnabled && size > maxFrameSize) {
- throw IOExceptionSupport.createFrameSizeException(size, maxFrameSize);
+ try {
+ final var context = new MarshallingContext();
+ marshallingContext.set(context);
+
+ if (!sizePrefixDisabled) {
+ int size = dis.readInt();
+ if (maxFrameSizeEnabled && size > maxFrameSize) {
+ throw IOExceptionSupport.createFrameSizeException(size, maxFrameSize);
+ }
+ context.setFrameSize(size);
}
- // int size = dis.readInt();
- // byte[] data = new byte[size];
- // dis.readFully(data);
- // bytesIn.restart(data);
- // dataIn = bytesIn;
+ return doUnmarshal(dis);
+ } finally {
+ // After we unmarshal we can clear
+ marshallingContext.remove();
}
- return doUnmarshal(dataIn);
}
/**
@@ -363,7 +372,7 @@ public final class OpenWireFormat implements WireFormat {
this.version = version;
}
- public Object doUnmarshal(DataInput dis) throws IOException {
+ private Object doUnmarshal(DataInput dis) throws IOException {
byte dataType = dis.readByte();
if (dataType != NULL_TYPE) {
DataStreamMarshaller dsm = dataMarshallers[dataType & 0xFF];
@@ -698,4 +707,47 @@ public final class OpenWireFormat implements WireFormat {
}
return version2;
}
+
+ MarshallingContext getMarshallingContext() {
+ return marshallingContext.get();
+ }
+
+ // Used to track the estimated allocated buffer sizes to validate
+ // against the current frame being processed
+ static class MarshallingContext {
+ // Use primitives to minimize memory footprint
+ private int frameSize = -1;
+ private int estimatedAllocated = 0;
+
+ void setFrameSize(int frameSize) throws IOException {
+ this.frameSize = frameSize;
+ if (frameSize < 0) {
+ throw error("Frame size " + frameSize + " can't be negative.");
+ }
+ }
+
+ void increment(int size) throws IOException {
+ if (size < 0) {
+ throw error("Size " + size + " can't be negative.");
+ }
+ try {
+ estimatedAllocated = Math.addExact(estimatedAllocated, size);
+ } catch (ArithmeticException e) {
+ throw error("Buffer overflow when incrementing size value: " + size);
+ }
+ }
+
+ public int getFrameSize() {
+ return frameSize;
+ }
+
+ public int getEstimatedAllocated() {
+ return estimatedAllocated;
+ }
+
+ private static IOException error(String errorMessage) {
+ return new IOException(new IllegalArgumentException(errorMessage));
+ }
+ }
+
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireUtil.java b/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireUtil.java
index 6ca48131a1..7f101535df 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireUtil.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/OpenWireUtil.java
@@ -16,10 +16,13 @@
*/
package org.apache.activemq.openwire;
+import java.io.IOException;
+import org.apache.activemq.util.IOExceptionSupport;
+
public class OpenWireUtil {
- private static final String jmsPackageToReplace = "jakarta.jms";
- private static final String jmsPackageToUse = "javax.jms";
+ static final String jmsPackageToReplace = "jakarta.jms";
+ static final String jmsPackageToUse = "javax.jms";
/**
* Verify that the provided class extends {@link Throwable} and throw an
@@ -33,6 +36,50 @@ public class OpenWireUtil {
}
}
+ /**
+ * Verify that the buffer size that will be allocated will not push the total allocated
+ * size of this frame above the expected frame size. This is an estimate as the current
+ * size is only tracked when calls to this method are made and is primarily intended
+ * to prevent large arrays from being created due to an invalid size.
+ *
+ * Also verify the size against configured max frame size.
+ * This check is a sanity check in case of corrupt packets contain invalid size values.
+ *
+ * @param wireFormat configured OpenWireFormat
+ * @param size buffer size to verify
+ * @throws IOException If size is larger than currentFrameSize or maxFrameSize
+ */
+ public static void validateBufferSize(OpenWireFormat wireFormat, int size) throws IOException {
+ validateLessThanFrameSize(wireFormat, size);
+
+ // if currentFrameSize is set and was checked above then this check should not be needed,
+ // but it doesn't hurt to verify again in case the max frame size check was missed
+ // somehow
+ if (wireFormat.isMaxFrameSizeEnabled() && size > wireFormat.getMaxFrameSize()) {
+ throw IOExceptionSupport.createFrameSizeException(size, wireFormat.getMaxFrameSize());
+ }
+ }
+
+ // Verify total tracked sizes will not exceed the overall size of the frame
+ private static void validateLessThanFrameSize(OpenWireFormat wireFormat, int size)
+ throws IOException {
+ final var context = wireFormat.getMarshallingContext();
+ // No information on current frame size so just return
+ if (context == null || context.getFrameSize() < 0) {
+ return;
+ }
+
+ // Increment existing estimated buffer size with new size
+ context.increment(size);
+
+ // We should never be trying to allocate a buffer that is going to push the total
+ // size greater than the entire frame itself
+ if (context.getEstimatedAllocated() > context.getFrameSize()) {
+ throw IOExceptionSupport.createFrameSizeBufferException(
+ context.getEstimatedAllocated(), context.getFrameSize());
+ }
+ }
+
/**
* This method can be used to convert from javax -> jakarta or
* vice versa depending on the version used by the client
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java
index a96f8e8411..910b461ef8 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/BaseDataStreamMarshaller.java
@@ -411,10 +411,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -438,10 +439,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -618,10 +620,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -637,10 +640,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/MessageMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/MessageMarshaller.java
index dd41daf6a5..bd81a8c00f 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/MessageMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/MessageMarshaller.java
@@ -65,8 +65,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination)tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure)tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId)tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -196,8 +196,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination)looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure)looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId)looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/PartialCommandMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/PartialCommandMarshaller.java
index 9ead0edd5f..6b317d4f7a 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/PartialCommandMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/PartialCommandMarshaller.java
@@ -68,7 +68,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -114,7 +114,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/WireFormatInfoMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/WireFormatInfoMarshaller.java
index fa939998d5..1e1544a8f6 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/WireFormatInfoMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/WireFormatInfoMarshaller.java
@@ -72,7 +72,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -130,7 +130,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/XATransactionIdMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/XATransactionIdMarshaller.java
index 7ac532ce93..438cd1a05a 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v1/XATransactionIdMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v1/XATransactionIdMarshaller.java
@@ -68,8 +68,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -117,8 +117,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/BaseDataStreamMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/BaseDataStreamMarshaller.java
index 6dc87a29a5..9fdeb72782 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/BaseDataStreamMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/BaseDataStreamMarshaller.java
@@ -410,10 +410,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -437,10 +438,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -617,10 +619,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -636,10 +639,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/ConnectionControlMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/ConnectionControlMarshaller.java
index 88be6bbe0c..b851e7fba1 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/ConnectionControlMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/ConnectionControlMarshaller.java
@@ -74,7 +74,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
info.setReconnectTo(tightUnmarshalString(dataIn, bs));
info.setRebalanceConnection(bs.readBoolean());
- info.setToken(tightUnmarshalByteArray(dataIn, bs));
+ info.setToken(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -142,7 +142,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(looseUnmarshalString(dataIn));
info.setReconnectTo(looseUnmarshalString(dataIn));
info.setRebalanceConnection(dataIn.readBoolean());
- info.setToken(looseUnmarshalByteArray(dataIn));
+ info.setToken(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/MessageMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/MessageMarshaller.java
index 262faffd78..3d4957f5cc 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/MessageMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/MessageMarshaller.java
@@ -69,8 +69,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -228,8 +228,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/PartialCommandMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/PartialCommandMarshaller.java
index 935acfff92..4a9fb29057 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/PartialCommandMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/PartialCommandMarshaller.java
@@ -67,7 +67,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -113,7 +113,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/WireFormatInfoMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/WireFormatInfoMarshaller.java
index 2d2ce4f9d1..d164e1c5ae 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/WireFormatInfoMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/WireFormatInfoMarshaller.java
@@ -71,7 +71,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -129,7 +129,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/XATransactionIdMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/XATransactionIdMarshaller.java
index fa2aae287c..cde7def8ef 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v10/XATransactionIdMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v10/XATransactionIdMarshaller.java
@@ -67,8 +67,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -116,8 +116,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/BaseDataStreamMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/BaseDataStreamMarshaller.java
index 4bcf109445..7d92331b5c 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/BaseDataStreamMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/BaseDataStreamMarshaller.java
@@ -409,10 +409,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -436,10 +437,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -616,10 +618,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -635,10 +638,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/ConnectionControlMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/ConnectionControlMarshaller.java
index 2a5a0cc0c5..23563eddd2 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/ConnectionControlMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/ConnectionControlMarshaller.java
@@ -74,7 +74,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
info.setReconnectTo(tightUnmarshalString(dataIn, bs));
info.setRebalanceConnection(bs.readBoolean());
- info.setToken(tightUnmarshalByteArray(dataIn, bs));
+ info.setToken(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -142,7 +142,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(looseUnmarshalString(dataIn));
info.setReconnectTo(looseUnmarshalString(dataIn));
info.setRebalanceConnection(dataIn.readBoolean());
- info.setToken(looseUnmarshalByteArray(dataIn));
+ info.setToken(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/MessageMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/MessageMarshaller.java
index 54a99423d1..e906955771 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/MessageMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/MessageMarshaller.java
@@ -69,8 +69,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -228,8 +228,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/PartialCommandMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/PartialCommandMarshaller.java
index db480e1ba4..4e5d17ebe9 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/PartialCommandMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/PartialCommandMarshaller.java
@@ -67,7 +67,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -113,7 +113,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/WireFormatInfoMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/WireFormatInfoMarshaller.java
index ef5e569fd5..0d5a893bc2 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/WireFormatInfoMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/WireFormatInfoMarshaller.java
@@ -71,7 +71,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -129,7 +129,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/XATransactionIdMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/XATransactionIdMarshaller.java
index ee4b5ecd35..bc9d311d3c 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v11/XATransactionIdMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v11/XATransactionIdMarshaller.java
@@ -67,8 +67,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -116,8 +116,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/BaseDataStreamMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/BaseDataStreamMarshaller.java
index 0b66e72bb8..612ab41ef3 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/BaseDataStreamMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/BaseDataStreamMarshaller.java
@@ -412,10 +412,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -439,10 +440,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -619,10 +621,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -638,10 +641,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/ConnectionControlMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/ConnectionControlMarshaller.java
index 1f15ffc035..c687c261bf 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/ConnectionControlMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/ConnectionControlMarshaller.java
@@ -74,7 +74,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
info.setReconnectTo(tightUnmarshalString(dataIn, bs));
info.setRebalanceConnection(bs.readBoolean());
- info.setToken(tightUnmarshalByteArray(dataIn, bs));
+ info.setToken(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -142,7 +142,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(looseUnmarshalString(dataIn));
info.setReconnectTo(looseUnmarshalString(dataIn));
info.setRebalanceConnection(dataIn.readBoolean());
- info.setToken(looseUnmarshalByteArray(dataIn));
+ info.setToken(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/MessageMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/MessageMarshaller.java
index 0f903a1662..d87e49a57a 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/MessageMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/MessageMarshaller.java
@@ -69,8 +69,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -228,8 +228,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/PartialCommandMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/PartialCommandMarshaller.java
index b816d8a794..6fc32d57ec 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/PartialCommandMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/PartialCommandMarshaller.java
@@ -67,7 +67,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -113,7 +113,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/WireFormatInfoMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/WireFormatInfoMarshaller.java
index f284dd5d85..a77e010733 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/WireFormatInfoMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/WireFormatInfoMarshaller.java
@@ -71,7 +71,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -129,7 +129,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/XATransactionIdMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/XATransactionIdMarshaller.java
index e25c5f33f5..ea3490cf8c 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v12/XATransactionIdMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v12/XATransactionIdMarshaller.java
@@ -67,8 +67,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -116,8 +116,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/BaseDataStreamMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/BaseDataStreamMarshaller.java
index 1f99292d5b..e2dd424dcc 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/BaseDataStreamMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/BaseDataStreamMarshaller.java
@@ -409,10 +409,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -436,10 +437,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -616,10 +618,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -635,10 +638,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/ConnectionControlMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/ConnectionControlMarshaller.java
index b28b191605..5dca9f3085 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/ConnectionControlMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/ConnectionControlMarshaller.java
@@ -74,7 +74,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
info.setReconnectTo(tightUnmarshalString(dataIn, bs));
info.setRebalanceConnection(bs.readBoolean());
- info.setToken(tightUnmarshalByteArray(dataIn, bs));
+ info.setToken(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -142,7 +142,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(looseUnmarshalString(dataIn));
info.setReconnectTo(looseUnmarshalString(dataIn));
info.setRebalanceConnection(dataIn.readBoolean());
- info.setToken(looseUnmarshalByteArray(dataIn));
+ info.setToken(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/MessageMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/MessageMarshaller.java
index b39ce065a0..2c1db93616 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/MessageMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/MessageMarshaller.java
@@ -69,8 +69,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -225,8 +225,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/PartialCommandMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/PartialCommandMarshaller.java
index d4445bdd4b..9278ddc8ca 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/PartialCommandMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/PartialCommandMarshaller.java
@@ -67,7 +67,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -113,7 +113,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/WireFormatInfoMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/WireFormatInfoMarshaller.java
index 005afb59f1..190a3f55fc 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/WireFormatInfoMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/WireFormatInfoMarshaller.java
@@ -71,7 +71,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -129,7 +129,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/XATransactionIdMarshaller.java b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/XATransactionIdMarshaller.java
index 525fda5765..231fdfa1fa 100644
--- a/activemq-client/src/main/java/org/apache/activemq/openwire/v9/XATransactionIdMarshaller.java
+++ b/activemq-client/src/main/java/org/apache/activemq/openwire/v9/XATransactionIdMarshaller.java
@@ -67,8 +67,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -116,8 +116,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-client/src/main/java/org/apache/activemq/util/IOExceptionSupport.java b/activemq-client/src/main/java/org/apache/activemq/util/IOExceptionSupport.java
index 0db3ce4fc4..6941726d3b 100644
--- a/activemq-client/src/main/java/org/apache/activemq/util/IOExceptionSupport.java
+++ b/activemq-client/src/main/java/org/apache/activemq/util/IOExceptionSupport.java
@@ -52,7 +52,13 @@ public final class IOExceptionSupport {
public static IOException createFrameSizeException(int size, long maxSize) {
return new MaxFrameSizeExceededException("Frame size of " + toHumanReadableSizeString(size) +
- " larger than max allowed " + toHumanReadableSizeString(maxSize));
+ " is larger than max allowed " + toHumanReadableSizeString(maxSize));
+ }
+
+ public static IOException createFrameSizeBufferException(int bufferSize, long frameSize) {
+ return new IOException("Estimated allocated buffer size of "
+ + toHumanReadableSizeString(bufferSize) + " is larger than frame size of "
+ + toHumanReadableSizeString(frameSize));
}
private static String toHumanReadableSizeString(final int size) {
diff --git a/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireUtilTest.java b/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireUtilTest.java
new file mode 100644
index 0000000000..93b12ee451
--- /dev/null
+++ b/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireUtilTest.java
@@ -0,0 +1,103 @@
+package org.apache.activemq.openwire;
+
+
+import javax.jms.InvalidClientIDException;
+import javax.jms.JMSException;
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.MaxFrameSizeExceededException;
+import org.apache.activemq.command.WireFormatInfo;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class OpenWireUtilTest {
+
+ @Test
+ public void testValidateIsThrowable() {
+ OpenWireUtil.validateIsThrowable(Exception.class);
+ OpenWireUtil.validateIsThrowable(Throwable.class);
+ OpenWireUtil.validateIsThrowable(JMSException.class);
+ OpenWireUtil.validateIsThrowable(InvalidClientIDException.class);
+
+ try {
+ OpenWireUtil.validateIsThrowable(String.class);
+ fail("Not a valid Throwable");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ OpenWireUtil.validateIsThrowable(ActiveMQConnection.class);
+ fail("Not a valid Throwable");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ }
+
+ @Test
+ public void testConvertJmsPackage() {
+ // should not change
+ assertEquals(InvalidClientIDException.class.getName(),
+ OpenWireUtil.convertJmsPackage(InvalidClientIDException.class.getName()));
+
+ // should convert to correct exception type
+ assertEquals(InvalidClientIDException.class.getName(),
+ OpenWireUtil.convertJmsPackage(OpenWireUtil.jmsPackageToReplace + ".InvalidClientIDException"));
+ }
+
+ @Test
+ public void testValidateBufferSize() throws IOException {
+ OpenWireFormatFactory factory = new OpenWireFormatFactory();
+
+ var wireFormat = (OpenWireFormat) factory.createWireFormat();
+
+ // Nothing set, no validation
+ OpenWireUtil.validateBufferSize(wireFormat, 2048);
+
+ // verify max frame check works
+ try {
+ wireFormat.setMaxFrameSize(1024);
+ OpenWireUtil.validateBufferSize(wireFormat, 2048);
+ fail("should have failed");
+ } catch (MaxFrameSizeExceededException e) {
+ // expected
+ }
+
+ // rest max frame size back so we can test validating current size
+ // is less than expected buffer size
+ wireFormat.setMaxFrameSize(OpenWireFormat.DEFAULT_MAX_FRAME_SIZE);
+ WireFormatInfo wfi = new WireFormatInfo();
+ wfi.setProperty("test", "test");
+
+ // should be no error for the first 2 calls, last call should
+ // go over frame size and error
+ initContext(wireFormat, 2048);
+ OpenWireUtil.validateBufferSize(wireFormat, 1024);
+ OpenWireUtil.validateBufferSize(wireFormat, 1024);
+ try {
+ OpenWireUtil.validateBufferSize(wireFormat, 1);
+ fail("should have failed");
+ } catch (IOException e) {
+ // expected
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void initContext(OpenWireFormat format, int frameSize) throws IOException {
+ try {
+ Field mcThreadLocalField = OpenWireFormat.class.getDeclaredField("marshallingContext");
+ mcThreadLocalField.setAccessible(true);
+ var mcThreadLocal = (ThreadLocal<OpenWireFormat.MarshallingContext>) mcThreadLocalField.get(format);
+ var context = new OpenWireFormat.MarshallingContext();
+ context.setFrameSize(frameSize);
+ mcThreadLocal.set(context);
+ } catch (ReflectiveOperationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireValidationTest.java b/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireValidationTest.java
index e5c7687ee9..bbf99fc29a 100644
--- a/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireValidationTest.java
+++ b/activemq-client/src/test/java/org/apache/activemq/openwire/OpenWireValidationTest.java
@@ -16,19 +16,24 @@
*/
package org.apache.activemq.openwire;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
+import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.activemq.command.CommandTypes;
-import org.apache.activemq.command.ExceptionResponse;
+
+import javassist.util.proxy.MethodHandler;
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
+import org.apache.activemq.command.*;
+import org.apache.activemq.openwire.v1.BaseDataStreamMarshaller;
+import org.apache.activemq.transport.nio.NIOInputStream;
import org.apache.activemq.util.ByteSequence;
import org.junit.Before;
import org.junit.Test;
@@ -36,9 +41,10 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import static org.junit.Assert.*;
+
/**
- * Test that Openwire marshalling will validate Throwable types during
- * unmarshalling commands that contain a Throwable
+ * Test that Openwire marshalling will validate commands correctly
*/
@RunWith(Parameterized.class)
public class OpenWireValidationTest {
@@ -63,7 +69,7 @@ public class OpenWireValidationTest {
// This will make sure that we don't forget to update this test to include
// any future versions that are generated
assertTrue("List of Openwire versions does not include latest version",
- versions.contains((int)CommandTypes.PROTOCOL_VERSION));
+ versions.contains((int) CommandTypes.PROTOCOL_VERSION));
return versionObjs;
}
@@ -72,21 +78,98 @@ public class OpenWireValidationTest {
this.version = version;
}
+ @Test
+ public void testLooseUnmarshalByteSequenceValidation() throws Exception {
+ testUnmarshalByteSequenceValidation(false);
+ }
+
+ @Test
+ public void testTightUnmarshalByteSequenceValidation() throws Exception {
+ testUnmarshalByteSequenceValidation(true);
+ }
+
+ @Test
+ public void testLooseUnmarshalByteArray() throws Exception {
+ testUnmarshalByteArray(false);
+ }
+
+ @Test
+ public void testTightUnmarshalByteArray() throws Exception {
+ testUnmarshalByteArray(true);
+ }
+
+ // WireFormatInfo eventually delegates to BaseDataStreamMarshaller#tightUnmarshalByteSequence() and
+ // BaseDataStreamMarshaller#looseUnmarshalByteSequence()
+ private void testUnmarshalByteSequenceValidation(boolean tightEncoding) throws Exception {
+ WireFormatInfo wfi = new WireFormatInfo();
+ wfi.setProperty("prop1", "val1");
+ testUnmarshal(wfi, tightEncoding);
+ }
+
+ // PartialCommand eventually delegates to BaseDataStreamMarshaller#tightUnmarshalByteArray()
+ // and BaseDataStreamMarshaller#looseUnmarshalByteArray()
+ private void testUnmarshalByteArray(boolean tightEncoding) throws Exception {
+ PartialCommand pc = new PartialCommand();
+ pc.setData("bytes".getBytes(StandardCharsets.UTF_8));
+ testUnmarshal(pc, tightEncoding);
+ }
+
+ private void testUnmarshal(Command command, boolean tightEncoding) throws Exception {
+ var format = setupWireFormat(tightEncoding);
+ ByteSequence bss = format.marshal(command);
+ try {
+ // We should get an exception from an invalid size value that is too large
+ // Test OpenWireFormat#unmarshal(ByteSequence) method
+ format.unmarshal(bss);
+ fail("Should have received an IOException");
+ } catch (IOException io) {
+ assertTrue(io.getMessage().contains("Estimated allocated buffer size"));
+ assertTrue(io.getMessage().contains("is larger than frame size"));
+ }
+ // Verify thread local is cleared even after exception
+ assertNull(format.getMarshallingContext());
+
+ try {
+ // We should get an exception from an invalid size value that is too large
+ // Test OpenWireFormat#unmarshal(DataInput) method
+ format.unmarshal(new DataInputStream(new NIOInputStream(
+ ByteBuffer.wrap(bss.toArray()))));
+ fail("Should have received an IOException");
+ } catch (IOException io) {
+ assertTrue(io.getMessage().contains("Estimated allocated buffer size"));
+ assertTrue(io.getMessage().contains("is larger than frame size"));
+ }
+ // Verify thread local is cleared even after exception
+ assertNull(format.getMarshallingContext());
+ }
+
+ // Verify MarshallingContext thread local is cleared where there is
+ // successful unmarshalling and no error. The other tests that check
+ // validation works if invalid size will validate the context is cleared
+ // when there is an error
+ @Test
+ public void testUnmarshalNoErrorClearContext() throws Exception {
+ var format = new OpenWireFormat();
+ ByteSequence bss = format.marshal(new ConnectionInfo());
+
+ // make sure context cleared after calling
+ // OpenWireFormat#unmarshal(ByteSequence) method
+ format.unmarshal(bss);
+ assertNull(format.getMarshallingContext());
+
+ // Make sure context cleared after calling
+ // OpenWireFormat#unmarshal(DataInput) method
+ format.unmarshal(new DataInputStream(new NIOInputStream(
+ ByteBuffer.wrap(bss.toArray()))));
+ assertNull(format.getMarshallingContext());
+ }
+
@Test
public void testOpenwireThrowableValidation() throws Exception {
// Create a format which will use loose encoding by default
// The code for handling exception creation is shared between both
// tight/loose encoding so only need to test 1
- OpenWireFormat format = new OpenWireFormat();
-
- // Override the marshaller map with a custom impl to purposely marshal a class type that is
- // not a Throwable for testing the unmarshaller
- Class<?> marshallerFactory = getMarshallerFactory();
- Method createMarshallerMap = marshallerFactory.getMethod("createMarshallerMap", OpenWireFormat.class);
- DataStreamMarshaller[] map = (DataStreamMarshaller[]) createMarshallerMap.invoke(marshallerFactory, format);
- map[ExceptionResponse.DATA_STRUCTURE_TYPE] = getExceptionMarshaller();
- // This will trigger updating the marshaller from the marshaller map with the right version
- format.setVersion(version);
+ var format = setupWireFormat(false);
// Build the response and try to unmarshal which should give an IllegalArgumentExeption on unmarshall
// as the test marshaller should have encoded a class type that is not a Throwable
@@ -102,6 +185,23 @@ public class OpenWireValidationTest {
assertFalse(initialized.get());
}
+ private OpenWireFormat setupWireFormat(boolean tightEncoding) throws Exception {
+ // Create a format
+ OpenWireFormat format = new OpenWireFormat();
+ format.setTightEncodingEnabled(tightEncoding);
+
+ // Override the marshaller map with a custom impl to purposely marshal a bad size value
+ Class<?> marshallerFactory = getMarshallerFactory();
+ Method createMarshallerMap = marshallerFactory.getMethod("createMarshallerMap", OpenWireFormat.class);
+ DataStreamMarshaller[] map = (DataStreamMarshaller[]) createMarshallerMap.invoke(marshallerFactory, format);
+ map[ExceptionResponse.DATA_STRUCTURE_TYPE] = getExceptionMarshaller();
+ map[WireFormatInfo.DATA_STRUCTURE_TYPE] = getWireFormatInfoMarshaller();
+ map[PartialCommand.DATA_STRUCTURE_TYPE] = getPartialCommandMarshaller();
+ // This will trigger updating the marshaller from the marshaller map with the right version
+ format.setVersion(version);
+ return format;
+ }
+
static class NotAThrowable {
private String message;
@@ -181,4 +281,127 @@ public class OpenWireValidationTest {
}
}
+ // Create test marshallers for all non-legacy versions
+ // WireFormatInfo will test the bytesequence marshallers
+ protected DataStreamMarshaller getWireFormatInfoMarshaller() {
+ switch (version) {
+ case 12:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v12.WireFormatInfoMarshaller());
+ case 11:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v11.WireFormatInfoMarshaller());
+ case 10:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v10.WireFormatInfoMarshaller());
+ case 9:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v9.WireFormatInfoMarshaller());
+ case 1:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v1.WireFormatInfoMarshaller());
+ default:
+ throw new IllegalArgumentException("Unknown OpenWire version of " + version);
+ }
+ }
+
+ // PartialCommand will test the byte array marshallers
+ protected DataStreamMarshaller getPartialCommandMarshaller() {
+ switch (version) {
+ case 12:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v12.PartialCommandMarshaller());
+ case 11:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v11.PartialCommandMarshaller());
+ case 10:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v10.PartialCommandMarshaller());
+ case 9:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v9.PartialCommandMarshaller());
+ case 1:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v1.PartialCommandMarshaller());
+ default:
+ throw new IllegalArgumentException("Unknown OpenWire version of " + version);
+ }
+ }
+
+ protected static void badTightMarshalByteSequence(ByteSequence data, DataOutput dataOut,
+ BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ // Write an invalid length that is much larger than it should be
+ dataOut.writeInt(data.getLength() * 10);
+ dataOut.write(data.getData(), data.getOffset(), data.getLength());
+ }
+ }
+
+ protected static void badLooseMarshalByteSequence(ByteSequence data, DataOutput dataOut)
+ throws IOException {
+ dataOut.writeBoolean(data != null);
+ if (data != null) {
+ // Write an invalid length that is much larger than it should be
+ dataOut.writeInt(data.getLength() * 10);
+ dataOut.write(data.getData(), data.getOffset(), data.getLength());
+ }
+ }
+
+ protected static void badLooseMarshalByteArray(byte[] data,
+ DataOutput dataOut) throws IOException {
+ dataOut.writeBoolean(data != null);
+ if (data != null) {
+ // Write an invalid length that is much larger than it should be
+ dataOut.writeInt(data.length * 10);
+ dataOut.write(data);
+ }
+ }
+
+ protected static void badTightMarshalByteArray(byte[] data, DataOutput dataOut,
+ BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ // Write an invalid length that is much larger than it should be
+ dataOut.writeInt(data.length * 10);
+ dataOut.write(data);
+ }
+ }
+
+ // This will create a proxy object to wrap the marhallers so that we can intercept
+ // both the byte and bytesequence methods to write bad sizes for testing
+ protected DataStreamMarshaller proxyBadBufferCommand(DataStreamMarshaller marshaller) {
+ ProxyFactory factory = new ProxyFactory();
+ factory.setSuperclass(marshaller.getClass());
+ Class<?> clazz = factory.createClass();
+
+ try {
+ DataStreamMarshaller instance = (DataStreamMarshaller) clazz.getConstructor().newInstance();
+ ((ProxyObject) instance).setHandler(new BadBufferProxy());
+ return instance;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected static class BadBufferProxy implements MethodHandler {
+
+ @Override
+ public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
+ Object result = null;
+
+ try {
+ // This handles writing a bad size for all 4 types of methods that should validate
+ switch (thisMethod.getName()) {
+ case "looseMarshalByteArray":
+ badLooseMarshalByteArray((byte[]) args[1], (DataOutput) args[2]);
+ break;
+ case "tightMarshalByteArray2":
+ badTightMarshalByteArray((byte[]) args[0], (DataOutput) args[1], (BooleanStream) args[2]);
+ break;
+ case "looseMarshalByteSequence":
+ badLooseMarshalByteSequence((ByteSequence) args[1], (DataOutput) args[2]);
+ break;
+ case "tightMarshalByteSequence2":
+ badTightMarshalByteSequence((ByteSequence) args[0], (DataOutput) args[1], (BooleanStream) args[2]);
+ break;
+ default:
+ result = proceed.invoke(self, args);
+ break;
+ }
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+
+ return result;
+ }
+ }
}
diff --git a/activemq-openwire-legacy/pom.xml b/activemq-openwire-legacy/pom.xml
index fbae3bebbd..a16003c801 100644
--- a/activemq-openwire-legacy/pom.xml
+++ b/activemq-openwire-legacy/pom.xml
@@ -47,6 +47,11 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java
index ed8c904457..548cffc0a6 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/BaseDataStreamMarshaller.java
@@ -410,10 +410,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -437,10 +438,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -617,10 +619,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -636,10 +639,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/MessageMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/MessageMarshaller.java
index 7ef69bfeb0..cf4809fbe4 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/MessageMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/MessageMarshaller.java
@@ -65,8 +65,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination)tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure)tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId)tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -199,8 +199,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination)looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure)looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId)looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/PartialCommandMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/PartialCommandMarshaller.java
index caf762aa7e..667b17246c 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/PartialCommandMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/PartialCommandMarshaller.java
@@ -68,7 +68,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -114,7 +114,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/WireFormatInfoMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/WireFormatInfoMarshaller.java
index 4bde98948f..334bde464c 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/WireFormatInfoMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/WireFormatInfoMarshaller.java
@@ -72,7 +72,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -130,7 +130,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/XATransactionIdMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/XATransactionIdMarshaller.java
index 0cbb3d6606..4114852e44 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/XATransactionIdMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v2/XATransactionIdMarshaller.java
@@ -68,8 +68,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -117,8 +117,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java
index 4199157a11..3487cd2643 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/BaseDataStreamMarshaller.java
@@ -410,10 +410,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -437,10 +438,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -617,10 +619,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -636,10 +639,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/MessageMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/MessageMarshaller.java
index a8bc1670ec..f83e4be31d 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/MessageMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/MessageMarshaller.java
@@ -65,8 +65,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination)tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure)tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId)tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -218,8 +218,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination)looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure)looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId)looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/PartialCommandMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/PartialCommandMarshaller.java
index dbe353df45..444f4b0d66 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/PartialCommandMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/PartialCommandMarshaller.java
@@ -68,7 +68,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -114,7 +114,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/WireFormatInfoMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/WireFormatInfoMarshaller.java
index 88f01343b0..1dda23a5b0 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/WireFormatInfoMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/WireFormatInfoMarshaller.java
@@ -72,7 +72,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -130,7 +130,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/XATransactionIdMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/XATransactionIdMarshaller.java
index 70ffde520c..c771239a86 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/XATransactionIdMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v3/XATransactionIdMarshaller.java
@@ -68,8 +68,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -117,8 +117,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/BaseDataStreamMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/BaseDataStreamMarshaller.java
index 2c9720512c..9127fa73d9 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/BaseDataStreamMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/BaseDataStreamMarshaller.java
@@ -410,10 +410,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -437,10 +438,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -617,10 +619,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -636,10 +639,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/MessageMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/MessageMarshaller.java
index 8c844da475..fcd919c9e0 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/MessageMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/MessageMarshaller.java
@@ -69,8 +69,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -225,8 +225,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/PartialCommandMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/PartialCommandMarshaller.java
index 3f539c0a09..2709e4d262 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/PartialCommandMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/PartialCommandMarshaller.java
@@ -67,7 +67,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -113,7 +113,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/WireFormatInfoMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/WireFormatInfoMarshaller.java
index ec65a8c6a2..cb84511146 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/WireFormatInfoMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/WireFormatInfoMarshaller.java
@@ -71,7 +71,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -129,7 +129,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/XATransactionIdMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/XATransactionIdMarshaller.java
index 49073d2995..7ef00d2793 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/XATransactionIdMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v4/XATransactionIdMarshaller.java
@@ -67,8 +67,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -116,8 +116,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/BaseDataStreamMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/BaseDataStreamMarshaller.java
index 264f260a7d..114f9390ac 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/BaseDataStreamMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/BaseDataStreamMarshaller.java
@@ -410,10 +410,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -437,10 +438,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -617,10 +619,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -636,10 +639,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/MessageMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/MessageMarshaller.java
index 8314455ea6..8671cb9225 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/MessageMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/MessageMarshaller.java
@@ -69,8 +69,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -225,8 +225,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/PartialCommandMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/PartialCommandMarshaller.java
index 8537d480ab..450469abea 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/PartialCommandMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/PartialCommandMarshaller.java
@@ -67,7 +67,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -113,7 +113,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/WireFormatInfoMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/WireFormatInfoMarshaller.java
index b6e822265c..e3d473c251 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/WireFormatInfoMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/WireFormatInfoMarshaller.java
@@ -71,7 +71,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -129,7 +129,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/XATransactionIdMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/XATransactionIdMarshaller.java
index 40d5d57f66..c950dcdfc7 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/XATransactionIdMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v5/XATransactionIdMarshaller.java
@@ -67,8 +67,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -116,8 +116,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/BaseDataStreamMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/BaseDataStreamMarshaller.java
index fee3c0e4b5..544abed173 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/BaseDataStreamMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/BaseDataStreamMarshaller.java
@@ -410,10 +410,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -437,10 +438,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -617,10 +619,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -636,10 +639,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/MessageMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/MessageMarshaller.java
index a2c7ad5339..c511b68978 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/MessageMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/MessageMarshaller.java
@@ -69,8 +69,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -225,8 +225,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/PartialCommandMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/PartialCommandMarshaller.java
index 705169c7ff..46430cfb56 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/PartialCommandMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/PartialCommandMarshaller.java
@@ -67,7 +67,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -113,7 +113,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/WireFormatInfoMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/WireFormatInfoMarshaller.java
index d4bcecc2a9..51a1dc5b9f 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/WireFormatInfoMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/WireFormatInfoMarshaller.java
@@ -71,7 +71,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -129,7 +129,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/XATransactionIdMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/XATransactionIdMarshaller.java
index fc968e379c..c87251cab0 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/XATransactionIdMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v6/XATransactionIdMarshaller.java
@@ -67,8 +67,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -116,8 +116,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/BaseDataStreamMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/BaseDataStreamMarshaller.java
index db8aeb73cc..88afd740b8 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/BaseDataStreamMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/BaseDataStreamMarshaller.java
@@ -409,10 +409,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -436,10 +437,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -616,10 +618,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -635,10 +638,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/MessageMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/MessageMarshaller.java
index 2e05c4c684..f0a94c9e54 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/MessageMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/MessageMarshaller.java
@@ -69,8 +69,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -225,8 +225,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/PartialCommandMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/PartialCommandMarshaller.java
index 8a4c8fac01..0bcfa5df3f 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/PartialCommandMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/PartialCommandMarshaller.java
@@ -67,7 +67,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -113,7 +113,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/WireFormatInfoMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/WireFormatInfoMarshaller.java
index 9e4c12c470..1ebd9225a6 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/WireFormatInfoMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/WireFormatInfoMarshaller.java
@@ -71,7 +71,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -129,7 +129,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/XATransactionIdMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/XATransactionIdMarshaller.java
index 3a02551a4c..b93db8439b 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/XATransactionIdMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v7/XATransactionIdMarshaller.java
@@ -67,8 +67,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -116,8 +116,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/BaseDataStreamMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/BaseDataStreamMarshaller.java
index 47a0165ae5..4cc312309d 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/BaseDataStreamMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/BaseDataStreamMarshaller.java
@@ -409,10 +409,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected byte[] tightUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
byte rc[] = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -436,10 +437,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
+ protected ByteSequence tightUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs) throws IOException {
ByteSequence rc = null;
if (bs.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
return new ByteSequence(t, 0, size);
@@ -616,10 +618,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
+ protected byte[] looseUnmarshalByteArray(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
byte rc[] = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
rc = new byte[size];
dataIn.readFully(rc);
}
@@ -635,10 +638,11 @@ public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
}
}
- protected ByteSequence looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
+ protected ByteSequence looseUnmarshalByteSequence(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
ByteSequence rc = null;
if (dataIn.readBoolean()) {
int size = dataIn.readInt();
+ OpenWireUtil.validateBufferSize(wireFormat, size);
byte[] t = new byte[size];
dataIn.readFully(t);
rc = new ByteSequence(t, 0, size);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/ConnectionControlMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/ConnectionControlMarshaller.java
index 32c5dd5b7e..8267934dfb 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/ConnectionControlMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/ConnectionControlMarshaller.java
@@ -74,7 +74,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(tightUnmarshalString(dataIn, bs));
info.setReconnectTo(tightUnmarshalString(dataIn, bs));
info.setRebalanceConnection(bs.readBoolean());
- info.setToken(tightUnmarshalByteArray(dataIn, bs));
+ info.setToken(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -142,7 +142,7 @@ public class ConnectionControlMarshaller extends BaseCommandMarshaller {
info.setConnectedBrokers(looseUnmarshalString(dataIn));
info.setReconnectTo(looseUnmarshalString(dataIn));
info.setRebalanceConnection(dataIn.readBoolean());
- info.setToken(looseUnmarshalByteArray(dataIn));
+ info.setToken(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/MessageMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/MessageMarshaller.java
index f6e5f3d5fa..7ac54ca30b 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/MessageMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/MessageMarshaller.java
@@ -69,8 +69,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs));
info.setType(tightUnmarshalString(dataIn, bs));
- info.setContent(tightUnmarshalByteSequence(dataIn, bs));
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setContent(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.setDataStructure((org.apache.activemq.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setCompressed(bs.readBoolean());
@@ -225,8 +225,8 @@ public abstract class MessageMarshaller extends BaseCommandMarshaller {
info.setReplyTo((org.apache.activemq.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn));
info.setType(looseUnmarshalString(dataIn));
- info.setContent(looseUnmarshalByteSequence(dataIn));
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setContent(looseUnmarshalByteSequence(wireFormat, dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.setDataStructure((org.apache.activemq.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setTargetConsumerId((org.apache.activemq.command.ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setCompressed(dataIn.readBoolean());
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/PartialCommandMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/PartialCommandMarshaller.java
index 67c4b25b31..4f294639b5 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/PartialCommandMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/PartialCommandMarshaller.java
@@ -67,7 +67,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(tightUnmarshalByteArray(dataIn, bs));
+ info.setData(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -113,7 +113,7 @@ public class PartialCommandMarshaller extends BaseDataStreamMarshaller {
PartialCommand info = (PartialCommand)o;
info.setCommandId(dataIn.readInt());
- info.setData(looseUnmarshalByteArray(dataIn));
+ info.setData(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/WireFormatInfoMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/WireFormatInfoMarshaller.java
index c7ea8be853..4660e6344e 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/WireFormatInfoMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/WireFormatInfoMarshaller.java
@@ -71,7 +71,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs));
+ info.setMarshalledProperties(tightUnmarshalByteSequence(wireFormat, dataIn, bs));
info.afterUnmarshall(wireFormat);
@@ -129,7 +129,7 @@ public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller {
info.setMagic(looseUnmarshalConstByteArray(dataIn, 8));
info.setVersion(dataIn.readInt());
- info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn));
+ info.setMarshalledProperties(looseUnmarshalByteSequence(wireFormat, dataIn));
info.afterUnmarshall(wireFormat);
diff --git a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/XATransactionIdMarshaller.java b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/XATransactionIdMarshaller.java
index 002945e991..8f50401203 100644
--- a/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/XATransactionIdMarshaller.java
+++ b/activemq-openwire-legacy/src/main/java/org/apache/activemq/openwire/v8/XATransactionIdMarshaller.java
@@ -67,8 +67,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
- info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
+ info.setGlobalTransactionId(tightUnmarshalByteArray(wireFormat, dataIn, bs));
+ info.setBranchQualifier(tightUnmarshalByteArray(wireFormat, dataIn, bs));
}
@@ -116,8 +116,8 @@ public class XATransactionIdMarshaller extends TransactionIdMarshaller {
XATransactionId info = (XATransactionId)o;
info.setFormatId(dataIn.readInt());
- info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn));
- info.setBranchQualifier(looseUnmarshalByteArray(dataIn));
+ info.setGlobalTransactionId(looseUnmarshalByteArray(wireFormat, dataIn));
+ info.setBranchQualifier(looseUnmarshalByteArray(wireFormat, dataIn));
}
diff --git a/activemq-openwire-legacy/src/test/java/org/apache/activemq/openwire/OpenWireLegacyValidationTest.java b/activemq-openwire-legacy/src/test/java/org/apache/activemq/openwire/OpenWireLegacyValidationTest.java
index daee1344b3..0c051ffe2b 100644
--- a/activemq-openwire-legacy/src/test/java/org/apache/activemq/openwire/OpenWireLegacyValidationTest.java
+++ b/activemq-openwire-legacy/src/test/java/org/apache/activemq/openwire/OpenWireLegacyValidationTest.java
@@ -21,13 +21,13 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import org.apache.activemq.util.ByteSequence;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
/**
- * Test that Openwire marshalling for legacy versions will validate Throwable types during
- * unmarshalling commands that contain a Throwable
+ * Test that Openwire marshalling for legacy versions will validate certain commands correctly
*/
@RunWith(Parameterized.class)
public class OpenWireLegacyValidationTest extends OpenWireValidationTest {
@@ -126,4 +126,46 @@ public class OpenWireLegacyValidationTest extends OpenWireValidationTest {
}
}
+ protected DataStreamMarshaller getWireFormatInfoMarshaller() {
+ switch (version) {
+ case 2:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v2.WireFormatInfoMarshaller());
+ case 3:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v3.WireFormatInfoMarshaller());
+ case 4:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v4.WireFormatInfoMarshaller());
+ case 5:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v5.WireFormatInfoMarshaller());
+ case 6:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v6.WireFormatInfoMarshaller());
+ case 7:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v7.WireFormatInfoMarshaller());
+ case 8:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v8.WireFormatInfoMarshaller());
+ default:
+ throw new IllegalArgumentException("Unknown OpenWire version of " + version);
+ }
+ }
+
+ protected DataStreamMarshaller getPartialCommandMarshaller() {
+ switch (version) {
+ case 2:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v2.PartialCommandMarshaller());
+ case 3:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v3.PartialCommandMarshaller());
+ case 4:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v4.PartialCommandMarshaller());
+ case 5:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v5.PartialCommandMarshaller());
+ case 6:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v6.PartialCommandMarshaller());
+ case 7:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v7.PartialCommandMarshaller());
+ case 8:
+ return proxyBadBufferCommand(new org.apache.activemq.openwire.v8.PartialCommandMarshaller());
+ default:
+ throw new IllegalArgumentException("Unknown OpenWire version of " + version);
+ }
+ }
+
}
diff --git a/pom.xml b/pom.xml
index 66aa216612..fcee52d9a1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,6 +76,7 @@
<jetty-version>${jetty9-version}</jetty-version>
<jmdns-version>3.6.0</jmdns-version>
<tomcat-api-version>9.0.65</tomcat-api-version>
+ <javassist-version>3.30.2-GA</javassist-version>
<jettison-version>1.5.4</jettison-version>
<jmock-version>2.13.1</jmock-version>
<jolokia-version>1.7.1</jolokia-version>
@@ -1039,6 +1040,11 @@
<artifactId>jettison</artifactId>
<version>${jettison-version}</version>
</dependency>
+ <dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>${javassist-version}</version>
+ </dependency>
<dependency>
<groupId>annogen</groupId>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact