You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
causes incorrect reports of the number of written bytes when the buffer size is >= 2^31:
std::string buf(2'147'483'648, '*'); // a buffer of up to 2'147'483'647 bytes would be just fineauto bytes_transferred = socket.write_some(asio::buffer(buf));
assert(bytes_transferred == 0); // reports 0 while all 2'147'483'648 bytes are written successfully
The same issue occurs for async_write_some when the buffer size is >= 2^32:
std::string buf(4'294'967'296, '*'); // a buffer of up to 4'294'967'295 bytes would be just fineauto bytes_transferred = co_await socket.async_write_some(asio::buffer(buf), asio::deferred);
assert(bytes_transferred == 0); // reports 0 while all 4'294'967'296 bytes are written successfully
Because these types of limitations are platform-dependent, the expected behavior might be that async_write_some and write_some internally limit the buffer size instead of exhibiting surprising or undefined behavior.
The text was updated successfully, but these errors were encountered:
It seems that the limit of the buffer size allowed to pass to
async_write_some
andwrite_some
is platform-dependent and undocumented.For example, on Windows, a narrowing conversion in this line:
asio/asio/include/asio/detail/impl/socket_ops.ipp
Line 1386 in ed5db1b
causes incorrect reports of the number of written bytes when the buffer size is >= 2^31:
The same issue occurs for async_write_some when the buffer size is >= 2^32:
Because these types of limitations are platform-dependent, the expected behavior might be that
async_write_some
andwrite_some
internally limit the buffer size instead of exhibiting surprising or undefined behavior.The text was updated successfully, but these errors were encountered: