diff options
author | Benoit Foucher <benoit@zeroc.com> | 2018-03-20 21:18:10 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2018-03-20 21:18:25 +0100 |
commit | a157ae70831fd23d0c27f118d108d7f13bce3b45 (patch) | |
tree | ae65d3dbfff9ef416e94e49a22d1a826d95a9e0c /js | |
parent | Run JavaScript es6 test suite with Edge (diff) | |
download | ice-a157ae70831fd23d0c27f118d108d7f13bce3b45.tar.bz2 ice-a157ae70831fd23d0c27f118d108d7f13bce3b45.tar.xz ice-a157ae70831fd23d0c27f118d108d7f13bce3b45.zip |
Added sanity checks for ACM timeout value (ICE-8749)
Diffstat (limited to 'js')
-rw-r--r-- | js/src/Ice/ACM.js | 5 | ||||
-rw-r--r-- | js/src/Ice/ConnectionI.js | 4 | ||||
-rw-r--r-- | js/test/Ice/acm/Client.js | 11 |
3 files changed, 19 insertions, 1 deletions
diff --git a/js/src/Ice/ACM.js b/js/src/Ice/ACM.js index 62752c36d0b..871cb999fa1 100644 --- a/js/src/Ice/ACM.js +++ b/js/src/Ice/ACM.js @@ -36,6 +36,11 @@ class ACMConfig } this.timeout = p.getPropertyAsIntWithDefault(timeoutProperty, dflt.timeout / 1000) * 1000; // To ms + if(this.timeout < 0) + { + l.warning("invalid value for property `" + timeoutProperty + "', default value will be used instead"); + this.timeout = dflt.timeout; + } const hb = p.getPropertyAsIntWithDefault(prefix + ".Heartbeat", dflt.heartbeat.value); if(hb >= 0 && hb <= Ice.ACMHeartbeat.maxValue) diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js index 33996e61ad4..351375c7635 100644 --- a/js/src/Ice/ConnectionI.js +++ b/js/src/Ice/ConnectionI.js @@ -502,6 +502,10 @@ class ConnectionI setACM(timeout, close, heartbeat) { + if(timeout !== undefined && timeout < 0) + { + throw new Error("invalid negative ACM timeout value"); + } if(this._monitor === null || this._state >= StateClosed) { return; diff --git a/js/test/Ice/acm/Client.js b/js/test/Ice/acm/Client.js index c86676a9553..8da91a6c2d9 100644 --- a/js/test/Ice/acm/Client.js +++ b/js/test/Ice/acm/Client.js @@ -191,7 +191,7 @@ async runTestCase(adapter, proxy) { await proxy.sleep(4); - test(this._heartbeat >= 6); + test(this._heartbeat >= 4); } } @@ -415,6 +415,15 @@ { let con = proxy.ice_getCachedConnection(); + try + { + con.setACM(-19, undefined, undefined); + test(false); + } + catch(ex) + { + } + let acm = con.getACM(); test(acm.timeout === 15); test(acm.close === Ice.ACMClose.CloseOnIdleForceful); |