summaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-04-26 09:00:57 +0200
committerBenoit Foucher <benoit@zeroc.com>2016-04-26 09:00:57 +0200
commitc2ce37b7b0f6fc033cac4d52d460ee2f389d7737 (patch)
treedab204bc1dfd9298c7acb13b9493a210f8c4e978 /js/src
parentAdd jquery-cookie to bower dependency (diff)
downloadice-c2ce37b7b0f6fc033cac4d52d460ee2f389d7737.tar.bz2
ice-c2ce37b7b0f6fc033cac4d52d460ee2f389d7737.tar.xz
ice-c2ce37b7b0f6fc033cac4d52d460ee2f389d7737.zip
Fixed ICE-7115 - unmarshalling bug with optional parameters
Diffstat (limited to 'js/src')
-rw-r--r--js/src/Ice/AsyncResult.js4
-rw-r--r--js/src/Ice/BasicStream.js23
-rw-r--r--js/src/Ice/IncomingAsync.js3
-rw-r--r--js/src/Ice/OutgoingAsync.js2
4 files changed, 18 insertions, 14 deletions
diff --git a/js/src/Ice/AsyncResult.js b/js/src/Ice/AsyncResult.js
index ee75db25e3a..0599e307584 100644
--- a/js/src/Ice/AsyncResult.js
+++ b/js/src/Ice/AsyncResult.js
@@ -38,7 +38,7 @@ var AsyncResult = Ice.Class(AsyncResultBase, {
{
return;
}
-
+
this._completed = completedFn;
this._is = null;
this._os = com !== null ? new BasicStream(this._instance, Protocol.currentProtocolEncoding) : null;
@@ -148,7 +148,7 @@ var AsyncResult = Ice.Class(AsyncResultBase, {
},
__readEmptyParams: function()
{
- this._is.skipEmptyEncaps(null);
+ this._is.skipEmptyEncaps();
},
__readParamEncaps: function()
{
diff --git a/js/src/Ice/BasicStream.js b/js/src/Ice/BasicStream.js
index 86218149b8a..b00b2d9adfb 100644
--- a/js/src/Ice/BasicStream.js
+++ b/js/src/Ice/BasicStream.js
@@ -1952,29 +1952,34 @@ var BasicStream = Class({
this._readEncapsCache = curr;
this._readEncapsCache.reset();
},
- skipEmptyEncaps: function(encoding)
+ skipEmptyEncaps: function()
{
- Debug.assert(encoding !== undefined);
var sz = this.readInt();
- if(sz !== 6)
+ if(sz < 6)
{
throw new Ice.EncapsulationException();
}
-
- var pos = this._buf.position;
- if(pos + 2 > this._buf.limit)
+ if(sz - 4 > this._buf.remaining)
{
throw new Ice.UnmarshalOutOfBoundsException();
}
- if(encoding !== null)
+ var encoding = new Ice.EncodingVersion();
+ encoding.__read(this);
+ if(encoding.equals(Ice.Encoding_1_0))
{
- encoding.__read(this);
+ if(sz != 6)
+ {
+ throw new Ice.EncapsulationException();
+ }
}
else
{
- this._buf.position = pos + 2;
+ // Skip the optional content of the encapsulation if we are expecting an
+ // empty encapsulation.
+ this._buf.position = this._buf.position + sz - 6;
}
+ return encoding;
},
endReadEncapsChecked: function() // Used by public stream API.
{
diff --git a/js/src/Ice/IncomingAsync.js b/js/src/Ice/IncomingAsync.js
index 713d92d51fd..eee2a0121a6 100644
--- a/js/src/Ice/IncomingAsync.js
+++ b/js/src/Ice/IncomingAsync.js
@@ -577,8 +577,7 @@ var IncomingAsync = Ice.Class({
},
readEmptyParams: function()
{
- this._current.encoding = new Ice.EncodingVersion();
- this._is.skipEmptyEncaps(this._current.encoding);
+ this._current.encoding = this._is.skipEmptyEncaps();
},
readParamEncaps: function()
{
diff --git a/js/src/Ice/OutgoingAsync.js b/js/src/Ice/OutgoingAsync.js
index 2b6214342de..e49c92fc0c7 100644
--- a/js/src/Ice/OutgoingAsync.js
+++ b/js/src/Ice/OutgoingAsync.js
@@ -491,7 +491,7 @@ var OutgoingAsync = Ice.Class(ProxyOutgoingAsyncBase, {
},
__readEmptyParams: function()
{
- this._is.skipEmptyEncaps(null);
+ this._is.skipEmptyEncaps();
},
__readParamEncaps: function()
{