diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-04-26 09:00:57 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-04-26 09:00:57 +0200 |
commit | c2ce37b7b0f6fc033cac4d52d460ee2f389d7737 (patch) | |
tree | dab204bc1dfd9298c7acb13b9493a210f8c4e978 /csharp/src | |
parent | Add jquery-cookie to bower dependency (diff) | |
download | ice-c2ce37b7b0f6fc033cac4d52d460ee2f389d7737.tar.bz2 ice-c2ce37b7b0f6fc033cac4d52d460ee2f389d7737.tar.xz ice-c2ce37b7b0f6fc033cac4d52d460ee2f389d7737.zip |
Fixed ICE-7115 - unmarshalling bug with optional parameters
Diffstat (limited to 'csharp/src')
-rw-r--r-- | csharp/src/Ice/BasicStream.cs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/csharp/src/Ice/BasicStream.cs b/csharp/src/Ice/BasicStream.cs index cb36056533d..ab73ab83374 100644 --- a/csharp/src/Ice/BasicStream.cs +++ b/csharp/src/Ice/BasicStream.cs @@ -460,13 +460,30 @@ namespace IceInternal public Ice.EncodingVersion skipEmptyEncaps() { int sz = readInt(); - if(sz != 6) + if(sz < 6) { throw new Ice.EncapsulationException(); } + if(sz - 4 > _buf.b.remaining()) + { + throw new Ice.UnmarshalOutOfBoundsException(); + } Ice.EncodingVersion encoding = new Ice.EncodingVersion(); encoding.read__(this); + if(encoding.Equals(Ice.Util.Encoding_1_0)) + { + if(sz != 6) + { + throw new Ice.EncapsulationException(); + } + } + else + { + // Skip the optional content of the encapsulation if we are expecting an + // empty encapsulation. + _buf.b.position(_buf.b.position() + sz - 6); + } return encoding; } @@ -4380,7 +4397,7 @@ namespace IceInternal if(_current.sliceType == SliceType.ObjectSlice) { throw new Ice.NoObjectFactoryException("no object factory found and compact format prevents " + - "slicing (the sender should use the sliced format " + + "slicing (the sender should use the sliced format " + "instead)", _current.typeId); } else |