From df59a6bb677c3f54c5ac7710f434cf30af32097d Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Mon, 8 Aug 2022 23:47:11 -0400 Subject: [PATCH 1/2] Regression test for https://github.com/Exiv2/exiv2/issues/2320 --- test/data/issue_2320_poc.jpg | Bin 0 -> 124 bytes tests/bugfixes/github/test_issue_2320.py | 11 +++++++++++ .../regression_tests/test_regression_allfiles.py | 1 + 3 files changed, 12 insertions(+) create mode 100644 test/data/issue_2320_poc.jpg create mode 100644 tests/bugfixes/github/test_issue_2320.py diff --git a/test/data/issue_2320_poc.jpg b/test/data/issue_2320_poc.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5757e109d96aedd93ab9bfc68b0937e8c908d084 GIT binary patch literal 124 zcmebEWzb?^U|<4bCj~s9J(GbGsD>YiS-{Hv!xS^X7+{(~gn Date: Mon, 8 Aug 2022 23:48:16 -0400 Subject: [PATCH 2/2] Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49894 Check that `60 * rem` won't overflow. --- src/tags_int.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tags_int.cpp b/src/tags_int.cpp index a81a1ad3..aa1d1de3 100644 --- a/src/tags_int.cpp +++ b/src/tags_int.cpp @@ -2519,7 +2519,7 @@ std::ostream& printDegrees(std::ostream& os, const Value& value, const ExifData* const int32_t mm = min.first / min.second; const int32_t rem = min.first % min.second; if ((min.second > 1) && (rem > 0)) { - if ((sec.first == 0) && (sec.second == 1)) { + if ((sec.first == 0) && (sec.second == 1) && (rem <= std::numeric_limits::max() / 60)) { sec.first = 60 * rem; sec.second = min.second; } else {