Make sure that read is complete to prevent infinite loop.

(cherry picked from commit ffe5eb517dad93845e62144d8e53f52b17420ecd)
main
Kevin Backhouse 4 years ago committed by mergify-bot
parent bc0f4f5bd0
commit 07225c05ee

@ -637,7 +637,7 @@ namespace Exiv2 {
// Read size and signature
std::memset(buf.pData_, 0x0, buf.size_);
bufRead = io_->read(buf.pData_, bufMinSize);
if (io_->error())
if (io_->error() || bufRead != bufMinSize)
throw Error(kerFailedToReadImageData);
if (bufRead < 2)
throw Error(kerNotAJpeg);

Loading…
Cancel
Save