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 /cpp/include | |
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 'cpp/include')
-rw-r--r-- | cpp/include/Ice/BasicStream.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h index da2ffde4a7f..0650e0971df 100644 --- a/cpp/include/Ice/BasicStream.h +++ b/cpp/include/Ice/BasicStream.h @@ -271,18 +271,29 @@ public: { Ice::Int sz; read(sz); - if(sz != static_cast<Ice::Int>(sizeof(Ice::Int)) + 2) + if(sz < 6) { throwEncapsulationException(__FILE__, __LINE__); } - - if(i + 2 > b.end()) + if(i - sizeof(Ice::Int) + sz > b.end()) { throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } - Ice::EncodingVersion encoding; read(encoding); + if(encoding == Ice::Encoding_1_0) + { + if(sz != static_cast<Ice::Int>(sizeof(Ice::Int)) + 2) + { + throwEncapsulationException(__FILE__, __LINE__); + } + } + else + { + // Skip the optional content of the encapsulation if we are expecting an + // empty encapsulation. + i += sz - sizeof(Ice::Int) - 2; + } return encoding; } void endReadEncapsChecked(); // Used by public stream API. |