Skip to content

Commit

Permalink
Make sure that read is complete to prevent infinite loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbackhouse committed Jul 17, 2021
1 parent 61cb1a1 commit ffe5eb5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/jpgimage.cpp
Expand Up @@ -641,7 +641,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);
Expand Down

0 comments on commit ffe5eb5

Please sign in to comment.