diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mono_picture_frame.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc index 7ac807cb..9af34c48 100644 --- a/src/mono_picture_frame.cc +++ b/src/mono_picture_frame.cc @@ -63,7 +63,11 @@ MonoPictureFrame::MonoPictureFrame (boost::filesystem::path path) boost::throw_exception (FileError ("could not open JPEG2000 file", path, errno)); } - fread (j2k_data(), 1, size, f); + size_t n = fread (j2k_data(), 1, size, f); + if (n != size) { + boost::throw_exception (FileError ("could not read from JPEG2000 file", path, errno)); + } + fclose (f); _buffer->Size (size); |
