summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/libexif
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/libexif')
-rw-r--r--meta/recipes-support/libexif/files/CVE-2020-0198.patch66
-rw-r--r--meta/recipes-support/libexif/files/CVE-2020-0452.patch39
-rw-r--r--meta/recipes-support/libexif/libexif/0001-Add-serial-tests-config-needed-by-ptest.patch26
-rw-r--r--meta/recipes-support/libexif/libexif/run-ptest3
-rw-r--r--meta/recipes-support/libexif/libexif_0.6.22.bb23
-rw-r--r--meta/recipes-support/libexif/libexif_0.6.24.bb47
6 files changed, 76 insertions, 128 deletions
diff --git a/meta/recipes-support/libexif/files/CVE-2020-0198.patch b/meta/recipes-support/libexif/files/CVE-2020-0198.patch
deleted file mode 100644
index 2a48844cb2..0000000000
--- a/meta/recipes-support/libexif/files/CVE-2020-0198.patch
+++ /dev/null
@@ -1,66 +0,0 @@
1From ca71eda33fe8421f98fbe20eb4392473357c1c43 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Wed, 30 Dec 2020 10:22:47 +0800
4Subject: [PATCH] fixed another unsigned integer overflow
5
6first fixed by google in android fork,
7https://android.googlesource.com/platform/external/libexif/+/1e187b62682ffab5003c702657d6d725b4278f16%5E%21/#F0
8
9(use a more generic overflow check method, also check second overflow instance.)
10
11https://security-tracker.debian.org/tracker/CVE-2020-0198
12
13Upstream-Status: Backport[https://github.com/libexif/libexif/commit/ce03ad7ef4e8aeefce79192bf5b6f69fae396f0c]
14CVE: CVE-2020-0198
15
16Signed-off-by: Changqing Li <changqing.li@windriver.com>
17---
18 libexif/exif-data.c | 10 ++++++----
19 1 file changed, 6 insertions(+), 4 deletions(-)
20
21diff --git a/libexif/exif-data.c b/libexif/exif-data.c
22index 8b280d3..34d58fc 100644
23--- a/libexif/exif-data.c
24+++ b/libexif/exif-data.c
25@@ -47,6 +47,8 @@
26 #undef JPEG_MARKER_APP1
27 #define JPEG_MARKER_APP1 0xe1
28
29+#define CHECKOVERFLOW(offset,datasize,structsize) (( offset >= datasize) || (structsize > datasize) || (offset > datasize - structsize ))
30+
31 static const unsigned char ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
32
33 struct _ExifDataPrivate
34@@ -327,7 +329,7 @@ exif_data_load_data_thumbnail (ExifData *data, const unsigned char *d,
35 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", "Bogus thumbnail offset (%u).", o);
36 return;
37 }
38- if (s > ds - o) {
39+ if (CHECKOVERFLOW(o,ds,s)) {
40 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", "Bogus thumbnail size (%u), max would be %u.", s, ds-o);
41 return;
42 }
43@@ -420,9 +422,9 @@ exif_data_load_data_content (ExifData *data, ExifIfd ifd,
44 }
45
46 /* Read the number of entries */
47- if ((offset + 2 < offset) || (offset + 2 < 2) || (offset + 2 > ds)) {
48+ if (CHECKOVERFLOW(offset, ds, 2)) {
49 exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifData",
50- "Tag data past end of buffer (%u > %u)", offset+2, ds);
51+ "Tag data past end of buffer (%u+2 > %u)", offset, ds);
52 return;
53 }
54 n = exif_get_short (d + offset, data->priv->order);
55@@ -431,7 +433,7 @@ exif_data_load_data_content (ExifData *data, ExifIfd ifd,
56 offset += 2;
57
58 /* Check if we have enough data. */
59- if (offset + 12 * n > ds) {
60+ if (CHECKOVERFLOW(offset, ds, 12*n)) {
61 n = (ds - offset) / 12;
62 exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
63 "Short data; only loading %hu entries...", n);
64--
652.17.1
66
diff --git a/meta/recipes-support/libexif/files/CVE-2020-0452.patch b/meta/recipes-support/libexif/files/CVE-2020-0452.patch
deleted file mode 100644
index a117b8b369..0000000000
--- a/meta/recipes-support/libexif/files/CVE-2020-0452.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From 302acd49eba0a125b0f20692df6abc6f7f7ca53e Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Wed, 30 Dec 2020 10:18:51 +0800
4Subject: [PATCH] fixed a incorrect overflow check that could be optimized
5 away.
6
7inspired by:
8https://android.googlesource.com/platform/external/libexif/+/8e7345f3bc0bad06ac369d6cbc1124c8ceaf7d4b
9
10https://source.android.com/security/bulletin/2020-11-01
11
12CVE-2020-0452
13
14Upsteam-Status: Backport[https://github.com/libexif/libexif/commit/9266d14b5ca4e29b970fa03272318e5f99386e06]
15CVE: CVE-2020-0452
16
17Signed-off-by: Changqing Li <changqing.li@windriver.com>
18---
19 libexif/exif-entry.c | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
21
22diff --git a/libexif/exif-entry.c b/libexif/exif-entry.c
23index 5de215f..3a6ce84 100644
24--- a/libexif/exif-entry.c
25+++ b/libexif/exif-entry.c
26@@ -1371,8 +1371,8 @@ exif_entry_get_value (ExifEntry *e, char *val, unsigned int maxlen)
27 {
28 unsigned char *utf16;
29
30- /* Sanity check the size to prevent overflow */
31- if (e->size+sizeof(uint16_t)+1 < e->size) break;
32+ /* Sanity check the size to prevent overflow. Note EXIF files are 64kb at most. */
33+ if (e->size >= 65536 - sizeof(uint16_t)*2) break;
34
35 /* The tag may not be U+0000-terminated , so make a local
36 U+0000-terminated copy before converting it */
37--
382.17.1
39
diff --git a/meta/recipes-support/libexif/libexif/0001-Add-serial-tests-config-needed-by-ptest.patch b/meta/recipes-support/libexif/libexif/0001-Add-serial-tests-config-needed-by-ptest.patch
new file mode 100644
index 0000000000..505aa07330
--- /dev/null
+++ b/meta/recipes-support/libexif/libexif/0001-Add-serial-tests-config-needed-by-ptest.patch
@@ -0,0 +1,26 @@
1From 1ee7217c8ae724d793f9a9876c3608057a2ccbf8 Mon Sep 17 00:00:00 2001
2From: Julien Stephan <jstephan@baylibre.com>
3Date: Tue, 11 Jul 2023 16:07:54 +0200
4Subject: [PATCH] Add serial-tests config needed by ptest
5
6Add serial-tests support, ptest needs it.
7
8Upstream-Status: Inappropriate [oe specific]
9
10Signed-off-by: Julien Stephan <jstephan@baylibre.com>
11---
12 configure.ac | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/configure.ac b/configure.ac
16index cd48047..5413907 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -16,6 +16,7 @@ AM_INIT_AUTOMAKE([
20 dist-zip
21 check-news
22 subdir-objects
23+ serial-tests
24 ])
25 AM_MAINTAINER_MODE
26
diff --git a/meta/recipes-support/libexif/libexif/run-ptest b/meta/recipes-support/libexif/libexif/run-ptest
new file mode 100644
index 0000000000..2d23159eb0
--- /dev/null
+++ b/meta/recipes-support/libexif/libexif/run-ptest
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3make -o Makefile runtest-TESTS
diff --git a/meta/recipes-support/libexif/libexif_0.6.22.bb b/meta/recipes-support/libexif/libexif_0.6.22.bb
deleted file mode 100644
index dc30926c59..0000000000
--- a/meta/recipes-support/libexif/libexif_0.6.22.bb
+++ /dev/null
@@ -1,23 +0,0 @@
1SUMMARY = "Library for reading extended image information (EXIF) from JPEG files"
2HOMEPAGE = "https://libexif.github.io/"
3SECTION = "libs"
4LICENSE = "LGPLv2.1"
5LIC_FILES_CHKSUM = "file://COPYING;md5=243b725d71bb5df4a1e5920b344b86ad"
6
7def version_underscore(v):
8 return "_".join(v.split("."))
9
10SRC_URI = "https://github.com/libexif/libexif/releases/download/libexif-${@version_underscore("${PV}")}-release/libexif-${PV}.tar.xz \
11 file://CVE-2020-0198.patch \
12 file://CVE-2020-0452.patch \
13 "
14
15SRC_URI[sha256sum] = "5048f1c8fc509cc636c2f97f4b40c293338b6041a5652082d5ee2cf54b530c56"
16
17UPSTREAM_CHECK_URI = "https://github.com/libexif/libexif/releases/"
18
19inherit autotools gettext
20
21EXTRA_OECONF += "--disable-docs"
22
23BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-support/libexif/libexif_0.6.24.bb b/meta/recipes-support/libexif/libexif_0.6.24.bb
new file mode 100644
index 0000000000..b407ee52de
--- /dev/null
+++ b/meta/recipes-support/libexif/libexif_0.6.24.bb
@@ -0,0 +1,47 @@
1SUMMARY = "Library for reading extended image information (EXIF) from JPEG files"
2DESCRIPTION = "libexif is a library for parsing, editing, and saving EXIF data. It is \
3intended to replace lots of redundant implementations in command-line \
4utilities and programs with GUIs."
5HOMEPAGE = "https://libexif.github.io/"
6SECTION = "libs"
7LICENSE = "LGPL-2.1-only"
8LIC_FILES_CHKSUM = "file://COPYING;md5=243b725d71bb5df4a1e5920b344b86ad"
9
10SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/libexif-${PV}.tar.bz2 \
11 file://0001-Add-serial-tests-config-needed-by-ptest.patch \
12 file://run-ptest \
13 "
14
15SRC_URI[sha256sum] = "d47564c433b733d83b6704c70477e0a4067811d184ec565258ac563d8223f6ae"
16
17inherit autotools gettext github-releases ptest
18
19EXTRA_OECONF += "--disable-docs"
20
21do_compile_ptest() {
22 oe_runmake -C test buildtest-TESTS
23}
24
25do_install_ptest() {
26 install ${B}/test/test*[!\.o] ${D}${PTEST_PATH}
27 for f in ${D}${PTEST_PATH}/test*; do
28 sed -i "s/\(LD_LIBRARY_PATH=\).*\(:\$LD_LIBRARY_PATH\)\"/\1.\2/" $f
29 done
30
31 install ${B}/test/Makefile ${D}${PTEST_PATH}
32 sed -i -e "/^srcdir/c srcdir = \$\{PWD\}" ${D}${PTEST_PATH}/Makefile
33
34 install -d ${D}${PTEST_PATH}/nls
35 install ${B}/test/nls/*[!\.o] ${D}${PTEST_PATH}/nls
36 install -d ${D}${PTEST_PATH}/.libs
37 install ${B}/test/.libs/* ${D}${PTEST_PATH}/.libs
38
39 install ${S}/test/*.sh ${D}${PTEST_PATH}
40
41 install -d ${D}${PTEST_PATH}/testdata
42 install ${S}/test/testdata/* ${D}${PTEST_PATH}/testdata
43}
44
45RDEPENDS:${PN}-ptest += "make bash"
46
47BBCLASSEXTEND = "native nativesdk"