diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 29311fd..c0d9553 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -268,6 +268,9 @@ namespace Exiv2 { #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Reading directory 0x" << std::hex << tag() << "\n"; #endif + if (this->offset() + this->size() > size) + throw Error(kerOffsetOutOfRange); + readDirectory(pData + offset(), this->size(), byteOrder); #ifdef EXIV2_DEBUG_MESSAGES std::cout << "<---- 0x" << std::hex << tag() << "\n";