id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12383,boost::asio fails to read more than 65536 bytes from file asyncronously,AStepanjuk@…,chris_kohlhoff,"When more than `65536` bytes are read into a buffer from a file using `boost::asio::windows::stream_handle` asynchronously, then buffer contains the wrong data after reading is completed. Starting from `65537`th byte the buffer contains the the data from the very beginning of the file, rather than the expected data. Here is a code example, which reproduces the issue: {{{ auto handle = ::CreateFile(L""BigFile.xml"", GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr); boost::asio::io_service ios; boost::asio::windows::stream_handle streamHandle(ios, handle); const auto to_read_bytes = 100000; char buffer[to_read_bytes]; boost::asio::async_read(streamHandle, boost::asio::buffer(buffer, to_read_bytes), [](auto &ec, auto read) { std::cout << ""Bytes read: "" << read << std::endl; }); ios.run(); auto bufferBegin = std::string(buffer, 38); auto bufferCorrupted = std::string(buffer + 65536, 38); // <- it contains bytes from the beginning of the file std::cout << ""offset 0: "" << bufferBegin << std::endl; std::cout << ""offset 65536: "" << bufferCorrupted << std::endl; ::CloseHandle(handle); }}} That code produces an output: > `Bytes read: 100000` [[br]] > `offset 0: ` [[br]] > `offset 65536: ` [[br]] The source file is a valid XML file, which is bigger than 65536 bytes in size. This is reproducible with boost 1.61 + VS2015. Also that issue was in boost 1.55 + VS2010. [[br]] Operating systems are: Windows 7 and Windows Server 2008R2.",Bugs,new,To Be Determined,asio,Boost 1.61.0,Problem,,,