Throw IO error if the number of read bytes does not match count

and the stream is in failed state
This commit is contained in:
Michael Krasnyk 2017-01-17 08:58:55 +01:00 committed by Patrick Niklaus
parent 46ac9d05d9
commit 7deff5837c

View File

@ -73,8 +73,9 @@ class FileReader
return;
const auto &result = input_stream.read(reinterpret_cast<char *>(dest), count * sizeof(T));
const std::size_t bytes_read = input_stream.gcount();
if (!result)
if (bytes_read != count && !result)
{
if (result.eof())
{