diff options
author | Michi Henning <michi@zeroc.com> | 2009-08-18 08:50:04 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2009-08-18 08:50:04 +1000 |
commit | 09445fc755dad18490d4a09b96ebc50af72d56b7 (patch) | |
tree | 8317e58d1f39ac1fbada52b8f6ea41d4ac8bb8e1 /java/src/IceInternal/BasicStream.java | |
parent | More changes for 3996 (diff) | |
download | ice-09445fc755dad18490d4a09b96ebc50af72d56b7.tar.bz2 ice-09445fc755dad18490d4a09b96ebc50af72d56b7.tar.xz ice-09445fc755dad18490d4a09b96ebc50af72d56b7.zip |
Bug 4201 - No checks on the encapsulation size
Diffstat (limited to 'java/src/IceInternal/BasicStream.java')
-rw-r--r-- | java/src/IceInternal/BasicStream.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java index 57827762773..ecc43a8918b 100644 --- a/java/src/IceInternal/BasicStream.java +++ b/java/src/IceInternal/BasicStream.java @@ -420,12 +420,12 @@ public class BasicStream // readSize()/writeSize(), it could be 1 or 5 bytes. // int sz = readInt(); - if(sz < 0) + if(sz < 6) { - throw new Ice.NegativeSizeException(); + throw new Ice.UnmarshalOutOfBoundsException(); } - if(sz - 4 > _buf.b.limit()) + if(sz - 4 > _buf.b.remaining()) { throw new Ice.UnmarshalOutOfBoundsException(); } @@ -484,9 +484,9 @@ public class BasicStream skipEmptyEncaps() { int sz = readInt(); - if(sz < 0) + if(sz < 6) { - throw new Ice.NegativeSizeException(); + throw new Ice.UnmarshalOutOfBoundsException(); } if(sz != 6) @@ -526,9 +526,9 @@ public class BasicStream skipEncaps() { int sz = readInt(); - if(sz < 0) + if(sz < 6) { - throw new Ice.NegativeSizeException(); + throw new Ice.UnmarshalOutOfBoundsException(); } try { @@ -556,9 +556,9 @@ public class BasicStream public void startReadSlice() { int sz = readInt(); - if(sz < 0) + if(sz < 4) { - throw new Ice.NegativeSizeException(); + throw new Ice.UnmarshalOutOfBoundsException(); } _readSlice = _buf.b.position(); } @@ -570,9 +570,9 @@ public class BasicStream public void skipSlice() { int sz = readInt(); - if(sz < 0) + if(sz < 4) { - throw new Ice.NegativeSizeException(); + throw new Ice.UnmarshalOutOfBoundsException(); } try { @@ -611,7 +611,7 @@ public class BasicStream int v = _buf.b.getInt(); if(v < 0) { - throw new Ice.NegativeSizeException(); + throw new Ice.UnmarshalOutOfBoundsException(); } return v; } |