diff options
author | Ulrich Bauer <mail@ulrich-bauer.org> | 2019-12-10 17:17:11 +0100 |
---|---|---|
committer | Ulrich Bauer <mail@ulrich-bauer.org> | 2019-12-10 17:17:11 +0100 |
commit | 47458eed67680f0beba78335b21748c1bfebeb76 (patch) | |
tree | f4e7f057b816ffa1ff9666385de32b2c438e949c /ripser.cpp | |
parent | 6a97e6c9e78a226abf4342d9b72bf1cc0235d775 (diff) |
fix to read, properly handling premature end of file
Diffstat (limited to 'ripser.cpp')
-rw-r--r-- | ripser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -836,7 +836,7 @@ static const bool is_big_endian = *reinterpret_cast<const uint8_t*>(&endian_chec template <typename T> T read(std::istream& input_stream) { T result; char* p = reinterpret_cast<char*>(&result); - input_stream.read(p, sizeof(T)); + if (input_stream.read(p, sizeof(T)) != sizeof(T) return T(); if (is_big_endian) std::reverse(p, p + sizeof(T)); return result; } |