Skip to content

Commit 5062ebe

Browse files
author
Matthias Radestock
committed
merge bug21798
2 parents 9f32b66 + a0dcfe4 commit 5062ebe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/com/rabbitmq/client/impl/ValueWriter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public final void writeShortstr(String str)
5959
throws IOException
6060
{
6161
byte [] bytes = str.getBytes("utf-8");
62+
int length = bytes.length;
63+
if (length > 255) {
64+
throw new IllegalArgumentException(
65+
"Short string too long; utf-8 encoded length = " + length +
66+
", max = 255.");
67+
}
6268
out.writeByte(bytes.length);
6369
out.write(bytes);
6470
}
@@ -91,7 +97,7 @@ public final void writeShort(int s)
9197
public final void writeLong(int l)
9298
throws IOException
9399
{
94-
// java's arithmetic on this type is signed, however its
100+
// java's arithmetic on this type is signed, however it's
95101
// reasonable to use ints to represent the unsigned long
96102
// type - for values < Integer.MAX_VALUE everything works
97103
// as expected

0 commit comments

Comments
 (0)