-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Implementation
-
None
If an invalid ifstream (e.g. one pointing to a non-existent file) without error bits set is passed to gridfs::bucket::upload_from_stream (or gridfs::bucket::upload_from_stream_with_id), the method will infinitely loop. This is because istream::read only throws an exception if `badbit` is set.
The most straightforward fix for this would be to set the error bits at the beginning of upload_from_stream_with_id so that errors will throw exceptions (and then document that this is the case):
source->exceptions(std::io::failbit | std::io::badbit);
- is depended on by
-
CXX-1317 bucket::upload_from_stream() and bucket::upload_from_stream_with_id() should abort upload on failure
- Closed