zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2k stars 592 forks source link

Make sure OutgoingMessage's output stream owns its memory #2259

Closed bernardnormier closed 4 weeks ago

bernardnormier commented 1 month ago

This PR updates Ice C++ to make sure the OutputStream held by an OutgoingMessage (see ConnectionI.h) owns its memory.

It's possible to create an OutputStream that doesn't own its memory with: https://github.com/zeroc-ice/ice/blob/e72309cdc7d1f4da178aa6b08d62b7ef0b183820/cpp/include/Ice/OutputStream.h#L65

It would be dangerous to construct an OutgoingResponse (or other outgoing message) with such an OutputStream as it may be sent later on, asynchronously, without copying of the memory.