diff --git a/backport-CVE-2020-0452.patch b/backport-CVE-2020-0452.patch new file mode 100644 index 0000000..55b9772 --- /dev/null +++ b/backport-CVE-2020-0452.patch @@ -0,0 +1,31 @@ +From 9266d14b5ca4e29b970fa03272318e5f99386e06 Mon Sep 17 00:00:00 2001 +From: Marcus Meissner +Date: Thu, 5 Nov 2020 09:50:08 +0100 +Subject: [PATCH] fixed a incorrect overflow check that could be optimized + away. + +inspired by: +https://android.googlesource.com/platform/external/libexif/+/8e7345f3bc0bad06ac369d6cbc1124c8ceaf7d4b + +https://source.android.com/security/bulletin/2020-11-01 + +CVE-2020-0452 +--- + libexif/exif-entry.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libexif/exif-entry.c b/libexif/exif-entry.c +index 3fc0ff92..4b866cee 100644 +--- a/libexif/exif-entry.c ++++ b/libexif/exif-entry.c +@@ -1371,8 +1371,8 @@ exif_entry_get_value (ExifEntry *e, char *val, unsigned int maxlen) + { + unsigned char *utf16; + +- /* Sanity check the size to prevent overflow */ +- if (e->size+sizeof(uint16_t)+1 < e->size) break; ++ /* Sanity check the size to prevent overflow. Note EXIF files are 64kb at most. */ ++ if (e->size >= 65536 - sizeof(uint16_t)*2) break; + + /* The tag may not be U+0000-terminated , so make a local + U+0000-terminated copy before converting it */ diff --git a/libexif.spec b/libexif.spec index 4f26d7c..a841769 100644 --- a/libexif.spec +++ b/libexif.spec @@ -1,7 +1,7 @@ Name: libexif Summary: Library for extracting extra information from image files Version: 0.6.22 -Release: 4 +Release: 5 License: LGPLv2+ URL: https://libexif.github.io/ @@ -10,6 +10,8 @@ Source0: https://github.com/libexif/libexif/archive/libexif-%(echo %{vers Patch0: CVE-2020-0198.patch Patch6000: backport-fuzz-stack-overflow.patch Patch6001: backport-fuzz-timeout-and-out-of-memory.patch +Patch6002: backport-CVE-2020-0452.patch + Patch9000: libexif-bugfix-integer-overflow-pentax.patch BuildRequires: autoconf automake doxygen gettext-devel libtool pkgconfig @@ -70,6 +72,9 @@ make check %doc libexif-api.html NEWS %changelog +* Mon Jan 15 2024 zhouwenpei - 0.6.22-5 +- fix CVE-2020-0452 + * Thu Aug 24 2023 zhouwenpei - 0.6.22-4 - fix typo in changelog