Fix UBSAN failure caused by left shift of a negative number.
This commit is contained in:
Kevin Backhouse 2021-09-22 23:55:15 +01:00
parent 90434bbe2f
commit a71bb64fe9
No known key found for this signature in database
GPG Key ID: 9DD01852EE40366E

View File

@ -1036,7 +1036,7 @@ namespace Exiv2 {
std::ostream& PentaxMakerNote::printDate(std::ostream& os, const Value& value, const ExifData*)
{
/* I choose same format as is used inside EXIF itself */
os << ((value.toLong(0) << 8) + value.toLong(1));
os << ((static_cast<uint64_t>(value.toLong(0)) << 8) + value.toLong(1));
os << ":";
os << std::setw(2) << std::setfill('0') << value.toLong(2);
os << ":";