summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Slater <joe.slater@windriver.com>2021-07-22 09:39:38 -0700
committerArmin Kuster <akuster808@gmail.com>2021-07-27 22:36:24 -0700
commit88813d34dd665cf90403716b88db2f0e0ec78d76 (patch)
treed194ba6d2f3f3eac03baed798222f712217c3e33
parent76a6070e6886fc7d623742bf0f7c4167b8b8dae8 (diff)
downloadmeta-openembedded-88813d34dd665cf90403716b88db2f0e0ec78d76.tar.gz
python3-pillow: fix CVE-2021-34552
Pull fix from version 8.3.1 back to 8.2.0. Signed-off-by: Joe Slater <joe.slater@windriver.com>
-rw-r--r--meta-python/recipes-devtools/python/python3-pillow/0001-Limit-sprintf-modes-to-10-characters.patch49
-rw-r--r--meta-python/recipes-devtools/python/python3-pillow/0001-Use-snprintf-instead-of-sprintf.patch43
-rw-r--r--meta-python/recipes-devtools/python/python3-pillow_8.2.0.bb2
3 files changed, 94 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pillow/0001-Limit-sprintf-modes-to-10-characters.patch b/meta-python/recipes-devtools/python/python3-pillow/0001-Limit-sprintf-modes-to-10-characters.patch
new file mode 100644
index 0000000000..a1dd0d29ff
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pillow/0001-Limit-sprintf-modes-to-10-characters.patch
@@ -0,0 +1,49 @@
1From 5f4504bb03f4edeeef8c2633dc5ba03a4c2a8a97 Mon Sep 17 00:00:00 2001
2From: Andrew Murray <radarhere@users.noreply.github.com>
3Date: Tue, 15 Jun 2021 15:14:26 +1000
4Subject: [PATCH 1/1] Limit sprintf modes to 10 characters
5
6Needed to make CVE-2021-34552 fix apply cleanly.
7
8commit 5f4504bb03f4edeeef8c2633dc5ba03a4c2a8a97 (unmodified)
9
10Upstream-Status: Backport
11Signed-off-by: Joe Slater <joe.slater@windriver.com>
12
13---
14 src/libImaging/Convert.c | 10 ++++------
15 1 file changed, 4 insertions(+), 6 deletions(-)
16
17diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c
18index 8c7be36a2..1fa74a13b 100644
19--- a/src/libImaging/Convert.c
20+++ b/src/libImaging/Convert.c
21@@ -1594,9 +1594,8 @@ convert(
22 #ifdef notdef
23 return (Imaging)ImagingError_ValueError("conversion not supported");
24 #else
25- static char buf[256];
26- /* FIXME: may overflow if mode is too large */
27- sprintf(buf, "conversion from %s to %s not supported", imIn->mode, mode);
28+ static char buf[100];
29+ sprintf(buf, "conversion from %.10s to %.10s not supported", imIn->mode, mode);
30 return (Imaging)ImagingError_ValueError(buf);
31 #endif
32 }
33@@ -1645,11 +1644,10 @@ ImagingConvertTransparent(Imaging imIn, const char *mode, int r, int g, int b) {
34 }
35 #else
36 {
37- static char buf[256];
38- /* FIXME: may overflow if mode is too large */
39+ static char buf[100];
40 sprintf(
41 buf,
42- "conversion from %s to %s not supported in convert_transparent",
43+ "conversion from %.10s to %.10s not supported in convert_transparent",
44 imIn->mode,
45 mode);
46 return (Imaging)ImagingError_ValueError(buf);
47--
482.29.2
49
diff --git a/meta-python/recipes-devtools/python/python3-pillow/0001-Use-snprintf-instead-of-sprintf.patch b/meta-python/recipes-devtools/python/python3-pillow/0001-Use-snprintf-instead-of-sprintf.patch
new file mode 100644
index 0000000000..fc0337f137
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pillow/0001-Use-snprintf-instead-of-sprintf.patch
@@ -0,0 +1,43 @@
1From 518ee3722a99d7f7d890db82a20bd81c1c0327fb Mon Sep 17 00:00:00 2001
2From: Andrew Murray <radarhere@users.noreply.github.com>
3Date: Wed, 30 Jun 2021 23:47:10 +1000
4Subject: [PATCH 1/1] Use snprintf instead of sprintf
5
6Fix CVE-2021-34552.
7
8commit 518ee3722a99d7f7d890db82a20bd81c1c0327fb (unmodified)
9
10Upstream-Status: Backport
11Signed-off-by: Joe Slater <joe.slater@windriver.com>
12
13---
14 src/libImaging/Convert.c | 5 +++--
15 1 file changed, 3 insertions(+), 2 deletions(-)
16
17diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c
18index 1fa74a13b..9012cfcd7 100644
19--- a/src/libImaging/Convert.c
20+++ b/src/libImaging/Convert.c
21@@ -1595,7 +1595,7 @@ convert(
22 return (Imaging)ImagingError_ValueError("conversion not supported");
23 #else
24 static char buf[100];
25- sprintf(buf, "conversion from %.10s to %.10s not supported", imIn->mode, mode);
26+ snprintf(buf, 100, "conversion from %.10s to %.10s not supported", imIn->mode, mode);
27 return (Imaging)ImagingError_ValueError(buf);
28 #endif
29 }
30@@ -1645,8 +1645,9 @@ ImagingConvertTransparent(Imaging imIn, const char *mode, int r, int g, int b) {
31 #else
32 {
33 static char buf[100];
34- sprintf(
35+ snprintf(
36 buf,
37+ 100,
38 "conversion from %.10s to %.10s not supported in convert_transparent",
39 imIn->mode,
40 mode);
41--
422.29.2
43
diff --git a/meta-python/recipes-devtools/python/python3-pillow_8.2.0.bb b/meta-python/recipes-devtools/python/python3-pillow_8.2.0.bb
index 3241230d13..40745bb763 100644
--- a/meta-python/recipes-devtools/python/python3-pillow_8.2.0.bb
+++ b/meta-python/recipes-devtools/python/python3-pillow_8.2.0.bb
@@ -8,6 +8,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=0337b116233da4616ae9fdb130bf6f1a"
8SRC_URI = "git://github.com/python-pillow/Pillow.git;branch=8.2.x \ 8SRC_URI = "git://github.com/python-pillow/Pillow.git;branch=8.2.x \
9 file://0001-support-cross-compiling.patch \ 9 file://0001-support-cross-compiling.patch \
10 file://0001-explicitly-set-compile-options.patch \ 10 file://0001-explicitly-set-compile-options.patch \
11 file://0001-Limit-sprintf-modes-to-10-characters.patch \
12 file://0001-Use-snprintf-instead-of-sprintf.patch \
11" 13"
12SRCREV ?= "e0e353c0ef7516979a9aedce3792596649ce4433" 14SRCREV ?= "e0e353c0ef7516979a9aedce3792596649ce4433"
13 15