iostreams icon indicating copy to clipboard operation
iostreams copied to clipboard

file_descriptor_impl::write() fails silently on Windows for writes of lengths that don't fit in a DWORD

Open lvoege opened this issue 7 years ago • 2 comments

https://github.com/boostorg/iostreams/blob/29a831798ec6337848d1f2e8595b59e5503e4f21/src/file_descriptor.cpp#L301

that static cast overflows when n doesn't fit in a DWORD, but then the un-overflowed value is returned. pass it 5GB to write and it'll write 1GB and cheerfully tell the caller it wrote the whole 5GB.

lvoege avatar Jan 13 '19 19:01 lvoege

If you write a test for it, I'll fix it. ;-) throw_system_failure("failed writing");

mclow avatar Jan 13 '19 19:01 mclow

Well, he wrote the test... :)

jeking3 avatar Feb 19 '19 20:02 jeking3