diff --git a/include/exiv2/value.hpp b/include/exiv2/value.hpp index 64a8ca7f..2078c6bd 100644 --- a/include/exiv2/value.hpp +++ b/include/exiv2/value.hpp @@ -44,6 +44,7 @@ #include #include #include +#include // ***************************************************************************** // namespace extensions @@ -1662,7 +1663,7 @@ namespace Exiv2 { template<> inline long ValueType::toLong(long n) const { - ok_ = (value_[n].second != 0); + ok_ = (value_[n].second != 0 && INT_MIN < value_[n].first && value_[n].first < INT_MAX ); if (!ok_) return 0; return value_[n].first / value_[n].second; }