zeroc-ice 3.8.1 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/dist/IceRuby/Operation.cpp +22 -6
  3. data/dist/ice/cpp/include/Ice/Config.h +2 -2
  4. data/dist/ice/cpp/include/Ice/LocalExceptions.h +21 -0
  5. data/dist/ice/cpp/include/Ice/OutputStream.h +7 -5
  6. data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +2 -2
  7. data/dist/ice/cpp/include/generated/Ice/Context.h +2 -2
  8. data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +2 -2
  9. data/dist/ice/cpp/include/generated/Ice/Identity.h +2 -2
  10. data/dist/ice/cpp/include/generated/Ice/Locator.h +9 -11
  11. data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +2 -2
  12. data/dist/ice/cpp/include/generated/Ice/Metrics.h +7 -7
  13. data/dist/ice/cpp/include/generated/Ice/OperationMode.h +2 -2
  14. data/dist/ice/cpp/include/generated/Ice/Process.h +2 -2
  15. data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +2 -2
  16. data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +2 -2
  17. data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +2 -2
  18. data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +8 -4
  19. data/dist/ice/cpp/include/generated/Ice/Router.h +7 -7
  20. data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +2 -2
  21. data/dist/ice/cpp/include/generated/Ice/Version.h +2 -2
  22. data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +2 -2
  23. data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +2 -2
  24. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +5 -3
  25. data/dist/ice/cpp/src/Ice/ConnectionI.cpp +27 -9
  26. data/dist/ice/cpp/src/Ice/ConnectionI.h +1 -1
  27. data/dist/ice/cpp/src/Ice/FileUtil.cpp +3 -67
  28. data/dist/ice/cpp/src/Ice/FileUtil.h +0 -3
  29. data/dist/ice/cpp/src/Ice/IPEndpointI.cpp +4 -0
  30. data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +1 -1
  31. data/dist/ice/cpp/src/Ice/InputStream.cpp +28 -15
  32. data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +6 -0
  33. data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +1 -1
  34. data/dist/ice/cpp/src/Ice/OutgoingResponse.cpp +127 -127
  35. data/dist/ice/cpp/src/Ice/OutgoingResponseInternal.h +21 -0
  36. data/dist/ice/cpp/src/Ice/OutputStream.cpp +46 -61
  37. data/dist/ice/cpp/src/Ice/PropertyNames.cpp +2 -1
  38. data/dist/ice/cpp/src/Ice/ProxyFunctions.cpp +4 -4
  39. data/dist/ice/cpp/src/Ice/Reference.cpp +15 -15
  40. data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +16 -13
  41. data/dist/ice/cpp/src/Ice/ResourceConfig.h +2 -2
  42. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +12 -11
  43. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.h +1 -2
  44. data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.cpp +1 -1
  45. data/dist/ice/cpp/src/Ice/SSL/SSLEngine.h +1 -4
  46. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +50 -43
  47. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.h +1 -5
  48. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +9 -0
  49. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +107 -14
  50. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.h +7 -2
  51. data/dist/ice/cpp/src/Ice/TcpEndpointI.cpp +2 -2
  52. data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +2 -2
  53. data/dist/ice/cpp/src/Ice/WSAcceptor.cpp +8 -3
  54. data/dist/ice/cpp/src/Ice/WSAcceptor.h +5 -1
  55. data/dist/ice/cpp/src/Ice/WSEndpoint.cpp +45 -2
  56. data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +118 -7
  57. data/dist/ice/cpp/src/Ice/WSTransceiver.h +12 -1
  58. data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +2 -2
  59. data/dist/ice/cpp/src/Ice/generated/Context.cpp +2 -2
  60. data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +2 -2
  61. data/dist/ice/cpp/src/Ice/generated/Identity.cpp +2 -2
  62. data/dist/ice/cpp/src/Ice/generated/Locator.cpp +2 -2
  63. data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +2 -2
  64. data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +2 -2
  65. data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +2 -2
  66. data/dist/ice/cpp/src/Ice/generated/Process.cpp +2 -2
  67. data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +2 -2
  68. data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +2 -2
  69. data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +2 -2
  70. data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +4 -2
  71. data/dist/ice/cpp/src/Ice/generated/Router.cpp +2 -2
  72. data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +2 -2
  73. data/dist/ice/cpp/src/Ice/generated/Version.cpp +2 -2
  74. data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +2 -2
  75. data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +2 -2
  76. data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +6 -6
  77. data/dist/ice/cpp/src/Slice/DocCommentParser.h +4 -2
  78. data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +24 -5
  79. data/dist/ice/cpp/src/Slice/MetadataValidation.h +3 -2
  80. data/dist/ice/cpp/src/Slice/Parser.cpp +117 -77
  81. data/dist/ice/cpp/src/Slice/Parser.h +19 -4
  82. data/dist/ice/cpp/src/Slice/Preprocessor.cpp +75 -19
  83. data/dist/ice/cpp/src/Slice/Preprocessor.h +0 -1
  84. data/dist/ice/cpp/src/Slice/SliceUtil.cpp +6 -58
  85. data/dist/ice/cpp/src/Slice/Util.h +0 -3
  86. data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +10 -8
  87. data/dist/ice/cpp/src/slice2rb/RubyUtil.h +10 -13
  88. data/dist/ice/slice/Ice/Identity.ice +3 -0
  89. data/dist/ice/slice/Ice/Locator.ice +6 -5
  90. data/dist/ice/slice/Ice/LocatorRegistry.ice +3 -0
  91. data/dist/ice/slice/Ice/Metrics.ice +1 -1
  92. data/dist/ice/slice/Ice/OperationMode.ice +8 -0
  93. data/dist/ice/slice/Ice/Process.ice +3 -0
  94. data/dist/ice/slice/Ice/ReplyStatus.ice +13 -0
  95. data/dist/lib/Glacier2/Metrics.rb +1 -1
  96. data/dist/lib/Glacier2/PermissionsVerifier.rb +3 -3
  97. data/dist/lib/Glacier2/Router.rb +8 -8
  98. data/dist/lib/Glacier2/SSLInfo.rb +1 -1
  99. data/dist/lib/Glacier2/Session.rb +15 -15
  100. data/dist/lib/Ice/BuiltinSequences.rb +1 -1
  101. data/dist/lib/Ice/Context.rb +1 -1
  102. data/dist/lib/Ice/EndpointTypes.rb +1 -1
  103. data/dist/lib/Ice/Identity.rb +1 -1
  104. data/dist/lib/Ice/LocalExceptions.rb +3 -0
  105. data/dist/lib/Ice/Locator.rb +5 -5
  106. data/dist/lib/Ice/LocatorRegistry.rb +4 -4
  107. data/dist/lib/Ice/Metrics.rb +7 -7
  108. data/dist/lib/Ice/OperationMode.rb +1 -1
  109. data/dist/lib/Ice/Process.rb +3 -3
  110. data/dist/lib/Ice/PropertiesAdmin.rb +4 -4
  111. data/dist/lib/Ice/PropertyDict.rb +1 -1
  112. data/dist/lib/Ice/ProxyFunctions.rb +8 -4
  113. data/dist/lib/Ice/RemoteLogger.rb +6 -6
  114. data/dist/lib/Ice/ReplyStatus.rb +3 -2
  115. data/dist/lib/Ice/Router.rb +5 -5
  116. data/dist/lib/Ice/SliceChecksumDict.rb +1 -1
  117. data/dist/lib/Ice/Version.rb +1 -1
  118. data/dist/lib/IceBox/ServiceManager.rb +8 -8
  119. data/dist/lib/IceGrid/Admin.rb +83 -83
  120. data/dist/lib/IceGrid/Descriptor.rb +1 -1
  121. data/dist/lib/IceGrid/Exception.rb +1 -1
  122. data/dist/lib/IceGrid/FileParser.rb +2 -2
  123. data/dist/lib/IceGrid/Registry.rb +13 -13
  124. data/dist/lib/IceGrid/Session.rb +6 -6
  125. data/dist/lib/IceGrid/UserAccountMapper.rb +2 -2
  126. data/dist/lib/IceStorm/IceStorm.rb +16 -16
  127. data/dist/lib/IceStorm/Metrics.rb +1 -1
  128. data/ice.gemspec +1 -1
  129. metadata +2 -1
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) ZeroC, Inc.
2
2
 
3
- // slice2cpp version 3.8.1
3
+ // slice2cpp version 3.8.2
4
4
  // <auto-generated>Generated from Slice file 'Lookup.ice'.</auto-generated>
5
5
  // clang-format off
6
6
 
@@ -18,7 +18,7 @@
18
18
  # if ICE_INT_VERSION % 100 >= 50
19
19
  # error Beta header file detected
20
20
  # endif
21
- # if ICE_INT_VERSION % 100 < 1
21
+ # if ICE_INT_VERSION % 100 < 2
22
22
  # error Ice patch level mismatch!
23
23
  # endif
24
24
  #endif
@@ -107,13 +107,15 @@ CollocatedRequestHandler::invokeAsyncRequest(OutgoingAsyncBase* outAsync, int ba
107
107
  //
108
108
  outAsync->cancelable(shared_from_this());
109
109
 
110
+ auto outAsyncPtr = outAsync->shared_from_this();
111
+
110
112
  if (_response)
111
113
  {
112
114
  requestId = ++_requestId;
113
- _asyncRequests.insert(make_pair(requestId, outAsync->shared_from_this()));
115
+ _asyncRequests.insert(make_pair(requestId, outAsyncPtr));
114
116
  }
115
117
 
116
- _sendAsyncRequests.insert(make_pair(outAsync->shared_from_this(), requestId));
118
+ _sendAsyncRequests.insert(make_pair(outAsyncPtr, requestId));
117
119
  }
118
120
 
119
121
  OutputStream* os = outAsync->getOs();
@@ -348,7 +350,7 @@ CollocatedRequestHandler::sendResponse(OutgoingResponse response)
348
350
  is.swap(*q->second->getIs());
349
351
  if (q->second->response())
350
352
  {
351
- outAsync = q->second;
353
+ outAsync = std::move(q->second);
352
354
  }
353
355
  _asyncRequests.erase(q);
354
356
  }
@@ -12,7 +12,8 @@
12
12
  #include "Ice/Properties.h"
13
13
  #include "IdleTimeoutTransceiverDecorator.h"
14
14
  #include "Instance.h"
15
- #include "ObjectAdapterI.h" // For getThreadPool()
15
+ #include "ObjectAdapterI.h" // For getThreadPool()
16
+ #include "OutgoingResponseInternal.h"
16
17
  #include "ReferenceFactory.h" // For createProxy().
17
18
  #include "RequestHandler.h" // For RetryException
18
19
  #include "ThreadPool.h"
@@ -1012,7 +1013,7 @@ Ice::ConnectionI::setAdapter(const ObjectAdapterPtr& adapter)
1012
1013
  {
1013
1014
  // Go through the adapter to set the adapter on this connection
1014
1015
  // to ensure the object adapter is still active.
1015
- dynamic_pointer_cast<ObjectAdapterI>(adapter)->setAdapterOnConnection(shared_from_this());
1016
+ static_pointer_cast<ObjectAdapterI>(adapter)->setAdapterOnConnection(shared_from_this());
1016
1017
  }
1017
1018
  else
1018
1019
  {
@@ -2717,7 +2718,7 @@ Ice::ConnectionI::sendNextMessages(vector<OutgoingMessage>& callbacks)
2717
2718
  _writeStream.swap(*message->stream);
2718
2719
  if (message->sent())
2719
2720
  {
2720
- callbacks.push_back(*message);
2721
+ callbacks.push_back(std::move(*message));
2721
2722
  }
2722
2723
  }
2723
2724
  _sendStreams.pop_front();
@@ -2850,7 +2851,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2850
2851
  // message was queued.
2851
2852
  if (!_sendStreams.empty())
2852
2853
  {
2853
- _sendStreams.push_back(message);
2854
+ _sendStreams.push_back(std::move(message));
2854
2855
  _sendStreams.back().adopt(nullptr);
2855
2856
  return AsyncStatusQueued;
2856
2857
  }
@@ -2895,7 +2896,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2895
2896
  return status;
2896
2897
  }
2897
2898
 
2898
- _sendStreams.push_back(message);
2899
+ _sendStreams.push_back(std::move(message));
2899
2900
  _sendStreams.back().adopt(&stream);
2900
2901
  }
2901
2902
  else
@@ -2945,7 +2946,7 @@ Ice::ConnectionI::sendMessage(OutgoingMessage& message)
2945
2946
  return status;
2946
2947
  }
2947
2948
 
2948
- _sendStreams.push_back(message);
2949
+ _sendStreams.push_back(std::move(message));
2949
2950
  _sendStreams.back().adopt(nullptr); // Adopt the stream.
2950
2951
  #ifdef ICE_HAS_BZIP2
2951
2952
  }
@@ -3260,6 +3261,22 @@ Ice::ConnectionI::parseMessage(int32_t& upcallCount, function<bool(InputStream&)
3260
3261
  "received batch request with " + to_string(requestCount) + " batches"};
3261
3262
  }
3262
3263
 
3264
+ // A batched request occupies at least 12 bytes on the wire (a 2-byte identity, a
3265
+ // 1-byte facet path, a 1-byte operation name, a 1-byte operation mode, a 1-byte
3266
+ // context, and a 6-byte parameters encapsulation). Reject a count larger than the
3267
+ // remaining message data could possibly hold. The message size is already capped
3268
+ // at Ice.MessageSizeMax (<= INT32_MAX bytes), so this also keeps requestCount well
3269
+ // within range when it is accumulated into the dispatch counters below.
3270
+ constexpr int32_t minBatchRequestSize = 12;
3271
+ if (requestCount > (stream.b.end() - stream.i) / minBatchRequestSize)
3272
+ {
3273
+ throw MarshalException{
3274
+ __FILE__,
3275
+ __LINE__,
3276
+ "received batch request with " + to_string(requestCount) +
3277
+ " batches, more than the message can contain"};
3278
+ }
3279
+
3263
3280
  upcall = [self = shared_from_this(), requestCount, adapter, compress](InputStream& messageStream)
3264
3281
  {
3265
3282
  self->dispatchAll(messageStream, requestCount, requestId, compress, adapter);
@@ -3297,7 +3314,7 @@ Ice::ConnectionI::parseMessage(int32_t& upcallCount, function<bool(InputStream&)
3297
3314
 
3298
3315
  if (q != _asyncRequests.end())
3299
3316
  {
3300
- auto outAsync = q->second;
3317
+ auto outAsync = std::move(q->second);
3301
3318
 
3302
3319
  if (q == _asyncRequestsHint)
3303
3320
  {
@@ -3437,9 +3454,10 @@ Ice::ConnectionI::dispatchAll(
3437
3454
  {
3438
3455
  // Received request on a connection without an object adapter.
3439
3456
  sendResponse(
3440
- makeOutgoingResponse(
3457
+ makeOutgoingResponseCore(
3441
3458
  make_exception_ptr(ObjectNotExistException{__FILE__, __LINE__}),
3442
- request.current()),
3459
+ request.current(),
3460
+ _instance.get()),
3443
3461
  0);
3444
3462
  }
3445
3463
 
@@ -72,7 +72,7 @@ namespace Ice
72
72
  public:
73
73
  std::shared_ptr<ConnectionI> shared_from_this()
74
74
  {
75
- return std::dynamic_pointer_cast<ConnectionI>(IceInternal::EventHandler::shared_from_this());
75
+ return std::static_pointer_cast<ConnectionI>(IceInternal::EventHandler::shared_from_this());
76
76
  }
77
77
 
78
78
  struct OutgoingMessage
@@ -195,34 +195,6 @@ IceInternal::mkdir(const string& path, int)
195
195
  return ::_wmkdir(stringToWstring(path, Ice::getProcessStringConverter()).c_str());
196
196
  }
197
197
 
198
- FILE*
199
- IceInternal::fopen(const string& path, const string& mode)
200
- {
201
- //
202
- // Don't need to use a wide string converter, the wide strings are directly passed
203
- // to Windows API.
204
- //
205
- const Ice::StringConverterPtr converter = Ice::getProcessStringConverter();
206
- return ::_wfopen(stringToWstring(path, converter).c_str(), stringToWstring(mode, converter).c_str());
207
- }
208
-
209
- int
210
- IceInternal::open(const string& path, int flags)
211
- {
212
- //
213
- // Don't need to use a wide string converter, the wide string is directly passed
214
- // to Windows API.
215
- //
216
- if (flags & _O_CREAT)
217
- {
218
- return ::_wopen(stringToWstring(path, Ice::getProcessStringConverter()).c_str(), flags, _S_IREAD | _S_IWRITE);
219
- }
220
- else
221
- {
222
- return ::_wopen(stringToWstring(path, Ice::getProcessStringConverter()).c_str(), flags);
223
- }
224
- }
225
-
226
198
  int
227
199
  IceInternal::getcwd(string& cwd)
228
200
  {
@@ -249,16 +221,6 @@ IceInternal::unlink(const string& path)
249
221
  return _wunlink(stringToWstring(path, Ice::getProcessStringConverter()).c_str());
250
222
  }
251
223
 
252
- int
253
- IceInternal::close(int fd)
254
- {
255
- # ifdef _WIN32
256
- return _close(fd);
257
- # else
258
- return ::close(fd);
259
- # endif
260
- }
261
-
262
224
  IceInternal::FileLock::FileLock(const std::string& path) : _path(path)
263
225
  {
264
226
  //
@@ -351,26 +313,6 @@ IceInternal::mkdir(const string& path, int perm)
351
313
  return ::mkdir(path.c_str(), static_cast<mode_t>(perm));
352
314
  }
353
315
 
354
- FILE*
355
- IceInternal::fopen(const string& path, const string& mode)
356
- {
357
- return ::fopen(path.c_str(), mode.c_str());
358
- }
359
-
360
- int
361
- IceInternal::open(const string& path, int flags)
362
- {
363
- if (flags & O_CREAT)
364
- {
365
- // By default, create with rw-rw-rw- modified by the user's umask (same as fopen).
366
- return ::open(path.c_str(), flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
367
- }
368
- else
369
- {
370
- return ::open(path.c_str(), flags);
371
- }
372
- }
373
-
374
316
  int
375
317
  IceInternal::getcwd(string& cwd)
376
318
  {
@@ -389,15 +331,9 @@ IceInternal::unlink(const string& path)
389
331
  return ::unlink(path.c_str());
390
332
  }
391
333
 
392
- int
393
- IceInternal::close(int fd)
394
- {
395
- return ::close(fd);
396
- }
397
-
398
334
  IceInternal::FileLock::FileLock(const std::string& path) : _path(path)
399
335
  {
400
- _fd = ::open(path.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
336
+ _fd = ::open(path.c_str(), O_RDWR | O_CREAT | O_NOFOLLOW, S_IRUSR | S_IWUSR);
401
337
  if (_fd < 0)
402
338
  {
403
339
  throw FileLockException(__FILE__, __LINE__, errno, _path);
@@ -417,7 +353,7 @@ IceInternal::FileLock::FileLock(const std::string& path) : _path(path)
417
353
  if (::fcntl(_fd, F_SETLK, &lock) == -1)
418
354
  {
419
355
  int err = errno;
420
- close(_fd);
356
+ ::close(_fd);
421
357
  throw FileLockException(__FILE__, __LINE__, err, _path);
422
358
  }
423
359
 
@@ -436,7 +372,7 @@ IceInternal::FileLock::FileLock(const std::string& path) : _path(path)
436
372
  if (write(_fd, os.str().c_str(), os.str().size()) == -1)
437
373
  {
438
374
  int err = errno;
439
- close(_fd);
375
+ ::close(_fd);
440
376
  throw FileLockException(__FILE__, __LINE__, err, _path);
441
377
  }
442
378
  }
@@ -84,13 +84,10 @@ namespace IceInternal
84
84
  ICE_API int rmdir(const std::string&);
85
85
 
86
86
  ICE_API int mkdir(const std::string&, int);
87
- ICE_API FILE* fopen(const std::string&, const std::string&);
88
87
  ICE_API FILE* freopen(const std::string&, const std::string&, FILE*);
89
- ICE_API int open(const std::string&, int);
90
88
  ICE_API int getcwd(std::string&);
91
89
 
92
90
  ICE_API int unlink(const std::string&);
93
- ICE_API int close(int);
94
91
 
95
92
  //
96
93
  // This class is used to implement process file locking. This class
@@ -419,6 +419,10 @@ IceInternal::IPEndpointI::IPEndpointI(ProtocolInstancePtr instance, InputStream*
419
419
  s->read(const_cast<string&>(_host), false);
420
420
  const_cast<string&>(_normalizedHost) = normalizeIPv6Address(_host);
421
421
  s->read(const_cast<int32_t&>(_port));
422
+ if (_port < 0 || _port > 65535)
423
+ {
424
+ throw MarshalException{__FILE__, __LINE__, "port value '" + to_string(_port) + "' is out of range"};
425
+ }
422
426
  }
423
427
 
424
428
  IceInternal::EndpointHostResolver::EndpointHostResolver(const InstancePtr& instance)
@@ -33,7 +33,7 @@ IncomingRequest::IncomingRequest(
33
33
  {
34
34
  throw MarshalException{__FILE__, __LINE__, "received facet path with more than one element"};
35
35
  }
36
- _current.facet = facetPath[0];
36
+ _current.facet = std::move(facetPath[0]);
37
37
  }
38
38
 
39
39
  inputStream.read(_current.operation, false);
@@ -428,14 +428,19 @@ Ice::InputStream::readAndCheckSeqSize(int minSize)
428
428
  // the estimated remaining buffer size. This estimation is based on
429
429
  // the minimum size of the enclosing sequences, it's _minSeqSize.
430
430
  //
431
- if (_startSeq == -1 || i > (b.begin() + _startSeq + _minSeqSize))
431
+ // 'sz' is peer-controlled (up to INT32_MAX), so we compute the minimum size of this sequence in
432
+ // 64-bit: 'sz * minSize' would otherwise overflow a 32-bit int and bypass the bounds check below.
433
+ int64_t minSeqSize = static_cast<int64_t>(sz) * minSize;
434
+
435
+ // '_startSeq + _minSeqSize' does not overflow: on the previous call, the bounds check below
436
+ // established this sum is <= b.size(), itself smaller than INT32_MAX.
437
+ if (_startSeq == -1 || (i - b.begin()) > _startSeq + _minSeqSize)
432
438
  {
433
439
  _startSeq = static_cast<int>(i - b.begin());
434
- _minSeqSize = sz * minSize;
435
440
  }
436
441
  else
437
442
  {
438
- _minSeqSize += sz * minSize;
443
+ minSeqSize += _minSeqSize;
439
444
  }
440
445
 
441
446
  //
@@ -443,11 +448,13 @@ Ice::InputStream::readAndCheckSeqSize(int minSize)
443
448
  // possibly enclosed sequences), something is wrong with the marshaled
444
449
  // data: it's claiming having more data that what is possible to read.
445
450
  //
446
- if (_startSeq + _minSeqSize > static_cast<int>(b.size()))
451
+ if (_startSeq + minSeqSize > static_cast<int64_t>(b.size()))
447
452
  {
448
453
  throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
449
454
  }
450
455
 
456
+ // minSeqSize is now known to be <= b.size(), itself smaller than INT32_MAX.
457
+ _minSeqSize = static_cast<int>(minSeqSize);
451
458
  return sz;
452
459
  }
453
460
 
@@ -474,15 +481,7 @@ Ice::InputStream::read(std::vector<byte>& v)
474
481
  {
475
482
  std::pair<const byte*, const byte*> p;
476
483
  read(p);
477
- if (p.first != p.second)
478
- {
479
- v.resize(static_cast<size_t>(p.second - p.first));
480
- copy(p.first, p.second, v.begin());
481
- }
482
- else
483
- {
484
- v.clear();
485
- }
484
+ v.assign(p.first, p.second);
486
485
  }
487
486
 
488
487
  void
@@ -1142,6 +1141,13 @@ Ice::InputStream::readOptImpl(int32_t readTag, OptionalFormat expectedFormat)
1142
1141
 
1143
1142
  auto format = static_cast<OptionalFormat>(v & 0x07); // First 3 bits.
1144
1143
  auto tag = static_cast<int32_t>(v >> 3);
1144
+ if (tag > 30)
1145
+ {
1146
+ // We check for '> 30' instead of '> 29' because 30 is special sentinel tag, handled by the next block.
1147
+ ostringstream os;
1148
+ os << "invalid tag '" << tag << "': tags larger than 29 must be encoded as a size";
1149
+ throw MarshalException(__FILE__, __LINE__, os.str());
1150
+ }
1145
1151
  if (tag == 30)
1146
1152
  {
1147
1153
  tag = readSize();
@@ -1916,7 +1922,11 @@ Ice::InputStream::EncapsDecoder11::startSlice()
1916
1922
  if (_current->sliceFlags & FLAG_HAS_SLICE_SIZE)
1917
1923
  {
1918
1924
  _stream->read(_current->sliceSize);
1919
- if (_current->sliceSize < 4)
1925
+ // A slice with optional members carries at least the 1-byte end marker in its body, so its
1926
+ // size (which includes the 4-byte size field) must be >= 5. We rely on this in skipSlice's
1927
+ // slice-preservation logic, which excludes the end marker by stepping back one byte.
1928
+ int32_t minSliceSize = (_current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS) ? 5 : 4;
1929
+ if (_current->sliceSize < minSliceSize)
1920
1930
  {
1921
1931
  throw MarshalException{__FILE__, __LINE__, endOfBufferMessage};
1922
1932
  }
@@ -2074,7 +2084,10 @@ Ice::InputStream::EncapsDecoder11::readOptional(int32_t readTag, Ice::OptionalFo
2074
2084
  int32_t
2075
2085
  Ice::InputStream::EncapsDecoder11::readInstance(int32_t index, const PatchFunc& patchFunc, void* patchAddr)
2076
2086
  {
2077
- assert(index > 0);
2087
+ if (index <= 0)
2088
+ {
2089
+ throw MarshalException(__FILE__, __LINE__, "invalid class instance index");
2090
+ }
2078
2091
 
2079
2092
  if (index > 1)
2080
2093
  {
@@ -570,6 +570,12 @@ Ice::TwowayOnlyException::ice_id() const noexcept
570
570
  return "::Ice::TwowayOnlyException";
571
571
  }
572
572
 
573
+ const char*
574
+ Ice::OnewayOnlyException::ice_id() const noexcept
575
+ {
576
+ return "::Ice::OnewayOnlyException";
577
+ }
578
+
573
579
  const char*
574
580
  Ice::PropertyException::ice_id() const noexcept
575
581
  {
@@ -817,7 +817,7 @@ OutgoingAsync::prepare(string_view operation, OperationMode mode, const Context&
817
817
  }
818
818
  else
819
819
  {
820
- string facet = ref->getFacet();
820
+ const string& facet = ref->getFacet();
821
821
  _os.write(&facet, &facet + 1);
822
822
  }
823
823