From 8e79d9a4e00828777e17276571fb8ed1b7cd49aa Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Fri, 2 Jul 2021 17:18:15 +0100 Subject: [PATCH 1/3] Regression test for https://github.com/Exiv2/exiv2/security/advisories/GHSA-h9x9-4f77-336w --- test/data/issue_ghsa_h9x9_4f77_336w_poc.exv | Bin 0 -> 34573 bytes .../github/test_issue_ghsa_h9x9_4f77_336w.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/data/issue_ghsa_h9x9_4f77_336w_poc.exv create mode 100644 tests/bugfixes/github/test_issue_ghsa_h9x9_4f77_336w.py diff --git a/test/data/issue_ghsa_h9x9_4f77_336w_poc.exv b/test/data/issue_ghsa_h9x9_4f77_336w_poc.exv new file mode 100644 index 0000000000000000000000000000000000000000..a8d7ae4ec00ce96736f4f50737c9b26717d8b491 GIT binary patch literal 34573 zcmeFZcUV(N!~cCwLJ~R*gx-sg&;tSK1dtXfNvI;aG%>KsQWOOj4JxRJbPy3S(k-~6 zprGQSQba`|fUC&5C@5lAz=G|aD7)*fW%qur-}7AWANR*A$v0=_%$as(<~up~9(7qA zon-p{X2uK@Q3&GUp@#?}2qJ+Xr~raOH6jA#tiDS?5Dbd_a9k9IVP`dt1J6J)2oWAT z17DJ}`U=!ivvK%o$$X*}QQU`g?!n_qv-%m-%Adp`&1wuhPJwC4!_OJ`GM!Cd3MLx8 z>0>^1pgy+-K^QLHevU!v&Oao?{g4p0BKn6|_1}-prG#i10|S;M zs8ftgOkq^S)P!PTZ9=g&HBqOST2oA{%`9L(O4onPy(i4tu37B|wdUrJwZqS`?yOeF z!kWtcSUVvwKwwtK@pZoNhg@ugnvnnTTpT=CXjV%?Eu8=HT3Im8kNE_|AQ?dlp_Z%o z^IAwH;X^v`QV2S$`K7}^&2P^(STktV$N2Cog84*aKhd~ZZ39one{x*#6D{q|BHrDHJahxk1B$xp-4#~JbRS`76k`G=Z+O%7%R_K}Z0 zAObd}z^o22LlE4oF4IR5J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C^zu zklc)$1^8JEoX2i+tiZb7{#8 zO5seAYDYwa-ZQYGKt*}q=x%2{a{SxPGsv=F20#B-6kr@cp(UL`#Xk28)nIYMELbe* z4BQ)b0bqvphk@Ce&DtIQ__0DhjnuB5BE1|BTpFgP9~!>}3_^WpV`ck?RuJ$HwVh#B z^Z$?q0dRu$dK#<(0VZW?$muWxFjrsa&Oi}p-NY-Gz(WAo94ltY1n)a}LJzf&_F PAX)O2cdH;`o__M*$A(em literal 0 HcmV?d00001 diff --git a/tests/bugfixes/github/test_issue_ghsa_h9x9_4f77_336w.py b/tests/bugfixes/github/test_issue_ghsa_h9x9_4f77_336w.py new file mode 100644 index 0000000000..d8c01d201b --- /dev/null +++ b/tests/bugfixes/github/test_issue_ghsa_h9x9_4f77_336w.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from system_tests import CaseMeta, CopyTmpFiles, path, check_no_ASAN_UBSAN_errors + +class Jp2ImageEncodeJp2HeaderOutOfBoundsRead2(metaclass=CaseMeta): + """ + Regression test for the bug described in: + https://github.com/Exiv2/exiv2/security/advisories/GHSA-h9x9-4f77-336w + """ + url = "https://github.com/Exiv2/exiv2/security/advisories/GHSA-h9x9-4f77-336w" + + filename = path("$data_path/issue_ghsa_h9x9_4f77_336w_poc.exv") + commands = ["$exiv2 -P t $filename"] + retval = [0] + + compare_stdout = check_no_ASAN_UBSAN_errors + compare_stderr = check_no_ASAN_UBSAN_errors From 18d168959792d1eb42bb71d001ff46b57d6b97ab Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Fri, 2 Jul 2021 17:19:58 +0100 Subject: [PATCH 2/3] Throw exception if lens info wasn't found. --- src/pentaxmn_int.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/pentaxmn_int.cpp b/src/pentaxmn_int.cpp index 313577eb85..73afa32bbd 100644 --- a/src/pentaxmn_int.cpp +++ b/src/pentaxmn_int.cpp @@ -1213,6 +1213,25 @@ namespace Exiv2 { return result; } + // Exception thrown by findLensInfo when the lens info can't be found. + class LensInfoNotFound : public std::exception { + public: + LensInfoNotFound() {} + }; + + // Throws std::exception if the LensInfo can't be found. + static ExifData::const_iterator findLensInfo(const ExifData* metadata) { + const ExifData::const_iterator dngLensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")); + if (dngLensInfo != metadata->end()) { + return dngLensInfo; + } + const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.Pentax.LensInfo")); + if (lensInfo != metadata->end()) { + return lensInfo; + } + throw LensInfoNotFound(); + } + //! resolveLens0x32c print lens in human format std::ostream& resolveLens0x32c(std::ostream& os, const Value& value, const ExifData* metadata) @@ -1249,11 +1268,7 @@ namespace Exiv2 { unsigned long index = 0; // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Pentax.html#LensData - const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) != metadata->end() - ? metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) - : metadata->findKey(ExifKey("Exif.Pentax.LensInfo")) - ; - if ( lensInfo == metadata->end() ) return EXV_PRINT_COMBITAG_MULTI(pentaxLensType, 2, 1, 2)(os, value, metadata); + const ExifData::const_iterator lensInfo = findLensInfo(metadata); if ( lensInfo->count() < 5 ) return EXV_PRINT_COMBITAG_MULTI(pentaxLensType, 2, 1, 2)(os, value, metadata); if ( value.count() == 2 ) { @@ -1307,10 +1322,7 @@ namespace Exiv2 { try { unsigned long index = 0; - const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) != metadata->end() - ? metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) - : metadata->findKey(ExifKey("Exif.Pentax.LensInfo")) - ; + const ExifData::const_iterator lensInfo = findLensInfo(metadata); if ( value.count() == 4 ) { std::string model = getKeyString("Exif.Image.Model" ,metadata); if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toLong(1) == 168 && lensInfo->toLong(2) == 144 ) index = 7; @@ -1335,10 +1347,7 @@ namespace Exiv2 { try { unsigned long index = 0; - const ExifData::const_iterator lensInfo = metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) != metadata->end() - ? metadata->findKey(ExifKey("Exif.PentaxDng.LensInfo")) - : metadata->findKey(ExifKey("Exif.Pentax.LensInfo")) - ; + const ExifData::const_iterator lensInfo = findLensInfo(metadata); if ( value.count() == 4 ) { std::string model = getKeyString("Exif.Image.Model" ,metadata); if ( model.rfind("PENTAX K-3", 0)==0 && lensInfo->count() == 128 && lensInfo->toLong(1) == 131 && lensInfo->toLong(2) == 128 ) From 3ac426b2c04004422c290425259082281e090116 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sat, 3 Jul 2021 22:36:53 +0100 Subject: [PATCH 3/3] Check that findKey didn't return end(). --- src/convert.cpp | 33 ++++++++++++++++++--------------- src/crwimage_int.cpp | 12 ++++++++++-- src/exif.cpp | 4 ++-- src/iptc.cpp | 4 ++-- src/xmp.cpp | 4 ++-- 5 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/convert.cpp b/src/convert.cpp index aa65626ac2..f4d1fdf0a1 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -665,16 +665,17 @@ namespace Exiv2 { if (subsecTag) { ExifData::iterator subsec_pos = exifData_->findKey(ExifKey(subsecTag)); - if ( subsec_pos != exifData_->end() - && subsec_pos->typeId() == asciiString) { - std::string ss = subsec_pos->toString(); - if (!ss.empty()) { - bool ok = false; - stringTo(ss, ok); - if (ok) subsec = std::string(".") + ss; + if (subsec_pos != exifData_->end()) { + if (subsec_pos->typeId() == asciiString) { + std::string ss = subsec_pos->toString(); + if (!ss.empty()) { + bool ok = false; + stringTo(ss, ok); + if (ok) subsec = std::string(".") + ss; + } } + if (erase_) exifData_->erase(subsec_pos); } - if (erase_) exifData_->erase(subsec_pos); } if (subsec.size() > 10) subsec = subsec.substr(0, 10); @@ -1027,18 +1028,20 @@ namespace Exiv2 { #endif } pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:RedEyeMode")); - if (pos != xmpData_->end() && pos->count() > 0) { - int red = pos->toLong(); - if (pos->value().ok()) - value |= (red & 1) << 6; + if (pos != xmpData_->end()) { + if (pos->count() > 0) { + int red = pos->toLong(); + if (pos->value().ok()) + value |= (red & 1) << 6; #ifndef SUPPRESS_WARNINGS - else - EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:RedEyeMode" << " to " << to << "\n"; + else + EXV_WARNING << "Failed to convert " << std::string(from) + "/exif:RedEyeMode" << " to " << to << "\n"; #endif + } + if (erase_) xmpData_->erase(pos); } (*exifData_)[to] = value; - if (erase_) xmpData_->erase(pos); } void Converter::cnvXmpGPSCoord(const char* from, const char* to) diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 6e89027556..01adf1f184 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -1100,8 +1100,16 @@ namespace Exiv2 { if (ed2 != edEnd) size += ed2->size(); if (size != 0) { DataBuf buf(size); - if (ed1 != edEnd) ed1->copy(buf.pData_, pHead->byteOrder()); - if (ed2 != edEnd) ed2->copy(buf.pData_ + ed1->size(), pHead->byteOrder()); + long pos = 0; + if (ed1 != edEnd) { + ed1->copy(buf.pData_, pHead->byteOrder()); + pos += ed1->size(); + } + if (ed2 != edEnd) { + ed2->copy(buf.pData_ + pos, pHead->byteOrder()); + pos += ed2->size(); + } + assert(pos == size); pHead->add(pCrwMapping->crwTagId_, pCrwMapping->crwDir_, buf); } else { diff --git a/src/exif.cpp b/src/exif.cpp index 263ab23dd3..685073b530 100644 --- a/src/exif.cpp +++ b/src/exif.cpp @@ -579,8 +579,8 @@ namespace Exiv2 { ExifKey exifKey(key); iterator pos = findKey(exifKey); if (pos == end()) { - add(Exifdatum(exifKey)); - pos = findKey(exifKey); + exifMetadata_.push_back(Exifdatum(exifKey)); + return exifMetadata_.back(); } return *pos; } diff --git a/src/iptc.cpp b/src/iptc.cpp index 908ef5bd9c..a73e158734 100644 --- a/src/iptc.cpp +++ b/src/iptc.cpp @@ -263,8 +263,8 @@ namespace Exiv2 { IptcKey iptcKey(key); iterator pos = findKey(iptcKey); if (pos == end()) { - add(Iptcdatum(iptcKey)); - pos = findKey(iptcKey); + iptcMetadata_.push_back(Iptcdatum(iptcKey)); + return iptcMetadata_.back(); } return *pos; } diff --git a/src/xmp.cpp b/src/xmp.cpp index 2cd2593677..9f47a1a8f9 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -308,8 +308,8 @@ namespace Exiv2 { XmpKey xmpKey(key); iterator pos = findKey(xmpKey); if (pos == end()) { - add(Xmpdatum(xmpKey)); - pos = findKey(xmpKey); + xmpMetadata_.push_back(Xmpdatum(xmpKey)); + return xmpMetadata_.back(); } return *pos; }