forked from openembedded/meta-openembedded
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openembedded#9 from Aclima/bokeh-2.4
Update packages for Bokeh 2.4
- Loading branch information
Showing
10 changed files
with
367 additions
and
43 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
...on/recipes-devtools/python/python3-pillow/0001-Handle-case-where-path-count-is-zero.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
From c48271ab354db49cdbd740bc45e13be4f0f7993c Mon Sep 17 00:00:00 2001 | ||
From: Andrew Murray <[email protected]> | ||
Date: Mon, 6 Dec 2021 22:25:14 +1100 | ||
Subject: [PATCH] Handle case where path count is zero | ||
|
||
CVE: CVE-2022-22816 | ||
|
||
Upstream-Status: Backport | ||
(https://github.com/python-pillow/Pillow/pull/5920/commits/c48271ab354db49cdbd740bc45e13be4f0f7993c) | ||
|
||
Signed-off-by: Trevor Gamblin <[email protected]> | ||
|
||
--- | ||
Tests/test_imagepath.py | 1 + | ||
src/path.c | 33 +++++++++++++++++++-------------- | ||
2 files changed, 20 insertions(+), 14 deletions(-) | ||
|
||
diff --git a/Tests/test_imagepath.py b/Tests/test_imagepath.py | ||
index cd850bb1..b18271cc 100644 | ||
--- a/Tests/test_imagepath.py | ||
+++ b/Tests/test_imagepath.py | ||
@@ -90,6 +90,7 @@ def test_path_odd_number_of_coordinates(): | ||
[ | ||
([0, 1, 2, 3], (0.0, 1.0, 2.0, 3.0)), | ||
([3, 2, 1, 0], (1.0, 0.0, 3.0, 2.0)), | ||
+ (0, (0.0, 0.0, 0.0, 0.0)), | ||
(1, (0.0, 0.0, 0.0, 0.0)), | ||
], | ||
) | ||
diff --git a/src/path.c b/src/path.c | ||
index 64c767cb..dea274ee 100644 | ||
--- a/src/path.c | ||
+++ b/src/path.c | ||
@@ -327,21 +327,26 @@ path_getbbox(PyPathObject *self, PyObject *args) { | ||
|
||
xy = self->xy; | ||
|
||
- x0 = x1 = xy[0]; | ||
- y0 = y1 = xy[1]; | ||
+ if (self->count == 0) { | ||
+ x0 = x1 = 0; | ||
+ y0 = y1 = 0; | ||
+ } else { | ||
+ x0 = x1 = xy[0]; | ||
+ y0 = y1 = xy[1]; | ||
|
||
- for (i = 1; i < self->count; i++) { | ||
- if (xy[i + i] < x0) { | ||
- x0 = xy[i + i]; | ||
- } | ||
- if (xy[i + i] > x1) { | ||
- x1 = xy[i + i]; | ||
- } | ||
- if (xy[i + i + 1] < y0) { | ||
- y0 = xy[i + i + 1]; | ||
- } | ||
- if (xy[i + i + 1] > y1) { | ||
- y1 = xy[i + i + 1]; | ||
+ for (i = 1; i < self->count; i++) { | ||
+ if (xy[i + i] < x0) { | ||
+ x0 = xy[i + i]; | ||
+ } | ||
+ if (xy[i + i] > x1) { | ||
+ x1 = xy[i + i]; | ||
+ } | ||
+ if (xy[i + i + 1] < y0) { | ||
+ y0 = xy[i + i + 1]; | ||
+ } | ||
+ if (xy[i + i + 1] > y1) { | ||
+ y1 = xy[i + i + 1]; | ||
+ } | ||
} | ||
} | ||
|
||
-- | ||
2.33.0 | ||
|
45 changes: 45 additions & 0 deletions
45
meta-python/recipes-devtools/python/python3-pillow/0001-Initialize-coordinates-to-zero.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From 1e092419b6806495c683043ab3feb6ce264f3b9c Mon Sep 17 00:00:00 2001 | ||
From: Andrew Murray <[email protected]> | ||
Date: Mon, 6 Dec 2021 22:24:19 +1100 | ||
Subject: [PATCH] Initialize coordinates to zero | ||
|
||
CVE: CVE-2022-22815 | ||
|
||
Upstream-Status: Backport | ||
(https://github.com/python-pillow/Pillow/pull/5920/commits/1e092419b6806495c683043ab3feb6ce264f3b9c) | ||
|
||
Signed-off-by: Trevor Gamblin <[email protected]> | ||
|
||
--- | ||
Tests/test_imagepath.py | 1 + | ||
src/path.c | 2 +- | ||
2 files changed, 2 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/Tests/test_imagepath.py b/Tests/test_imagepath.py | ||
index 0835fdb4..cd850bb1 100644 | ||
--- a/Tests/test_imagepath.py | ||
+++ b/Tests/test_imagepath.py | ||
@@ -90,6 +90,7 @@ def test_path_odd_number_of_coordinates(): | ||
[ | ||
([0, 1, 2, 3], (0.0, 1.0, 2.0, 3.0)), | ||
([3, 2, 1, 0], (1.0, 0.0, 3.0, 2.0)), | ||
+ (1, (0.0, 0.0, 0.0, 0.0)), | ||
], | ||
) | ||
def test_getbbox(coords, expected): | ||
diff --git a/src/path.c b/src/path.c | ||
index 4764c58a..64c767cb 100644 | ||
--- a/src/path.c | ||
+++ b/src/path.c | ||
@@ -57,7 +57,7 @@ alloc_array(Py_ssize_t count) { | ||
if ((unsigned long long)count > (SIZE_MAX / (2 * sizeof(double))) - 1) { | ||
return ImagingError_MemoryError(); | ||
} | ||
- xy = malloc(2 * count * sizeof(double) + 1); | ||
+ xy = calloc(2 * count * sizeof(double) + 1, sizeof(double)); | ||
if (!xy) { | ||
ImagingError_MemoryError(); | ||
} | ||
-- | ||
2.33.0 | ||
|
49 changes: 49 additions & 0 deletions
49
...on/recipes-devtools/python/python3-pillow/0001-Limit-sprintf-modes-to-10-characters.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From 5f4504bb03f4edeeef8c2633dc5ba03a4c2a8a97 Mon Sep 17 00:00:00 2001 | ||
From: Andrew Murray <[email protected]> | ||
Date: Tue, 15 Jun 2021 15:14:26 +1000 | ||
Subject: [PATCH 1/1] Limit sprintf modes to 10 characters | ||
|
||
Needed to make CVE-2021-34552 fix apply cleanly. | ||
|
||
commit 5f4504bb03f4edeeef8c2633dc5ba03a4c2a8a97 (unmodified) | ||
|
||
Upstream-Status: Backport | ||
Signed-off-by: Joe Slater <[email protected]> | ||
|
||
--- | ||
src/libImaging/Convert.c | 10 ++++------ | ||
1 file changed, 4 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c | ||
index 8c7be36a2..1fa74a13b 100644 | ||
--- a/src/libImaging/Convert.c | ||
+++ b/src/libImaging/Convert.c | ||
@@ -1594,9 +1594,8 @@ convert( | ||
#ifdef notdef | ||
return (Imaging)ImagingError_ValueError("conversion not supported"); | ||
#else | ||
- static char buf[256]; | ||
- /* FIXME: may overflow if mode is too large */ | ||
- sprintf(buf, "conversion from %s to %s not supported", imIn->mode, mode); | ||
+ static char buf[100]; | ||
+ sprintf(buf, "conversion from %.10s to %.10s not supported", imIn->mode, mode); | ||
return (Imaging)ImagingError_ValueError(buf); | ||
#endif | ||
} | ||
@@ -1645,11 +1644,10 @@ ImagingConvertTransparent(Imaging imIn, const char *mode, int r, int g, int b) { | ||
} | ||
#else | ||
{ | ||
- static char buf[256]; | ||
- /* FIXME: may overflow if mode is too large */ | ||
+ static char buf[100]; | ||
sprintf( | ||
buf, | ||
- "conversion from %s to %s not supported in convert_transparent", | ||
+ "conversion from %.10s to %.10s not supported in convert_transparent", | ||
imIn->mode, | ||
mode); | ||
return (Imaging)ImagingError_ValueError(buf); | ||
-- | ||
2.29.2 | ||
|
49 changes: 49 additions & 0 deletions
49
...devtools/python/python3-pillow/0001-Raise-ValueError-if-color-specifier-is-too-long.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From 9e08eb8f78fdfd2f476e1b20b7cf38683754866b Mon Sep 17 00:00:00 2001 | ||
From: Hugo van Kemenade <[email protected]> | ||
Date: Mon, 23 Aug 2021 19:10:49 +0300 | ||
Subject: [PATCH] Raise ValueError if color specifier is too long | ||
|
||
CVE: CVE-2021-23437 | ||
|
||
Upstream-Status: Backport | ||
(https://github.com/python-pillow/Pillow/commit/9e08eb8f78fdfd2f476e1b20b7cf38683754866b) | ||
|
||
Signed-off-by: Trevor Gamblin <[email protected]> | ||
--- | ||
Tests/test_imagecolor.py | 9 +++++++++ | ||
src/PIL/ImageColor.py | 2 ++ | ||
2 files changed, 11 insertions(+) | ||
|
||
diff --git a/Tests/test_imagecolor.py b/Tests/test_imagecolor.py | ||
index b5d69379..dbe8b9e9 100644 | ||
--- a/Tests/test_imagecolor.py | ||
+++ b/Tests/test_imagecolor.py | ||
@@ -191,3 +191,12 @@ def test_rounding_errors(): | ||
assert (255, 255) == ImageColor.getcolor("white", "LA") | ||
assert (163, 33) == ImageColor.getcolor("rgba(0, 255, 115, 33)", "LA") | ||
Image.new("LA", (1, 1), "white") | ||
+ | ||
+ | ||
+def test_color_too_long(): | ||
+ # Arrange | ||
+ color_too_long = "hsl(" + "1" * 100 + ")" | ||
+ | ||
+ # Act / Assert | ||
+ with pytest.raises(ValueError): | ||
+ ImageColor.getrgb(color_too_long) | ||
diff --git a/src/PIL/ImageColor.py b/src/PIL/ImageColor.py | ||
index 51df4404..25f92f2c 100644 | ||
--- a/src/PIL/ImageColor.py | ||
+++ b/src/PIL/ImageColor.py | ||
@@ -32,6 +32,8 @@ def getrgb(color): | ||
:param color: A color string | ||
:return: ``(red, green, blue[, alpha])`` | ||
""" | ||
+ if len(color) > 100: | ||
+ raise ValueError("color specifier is too long") | ||
color = color.lower() | ||
|
||
rgb = colormap.get(color, None) | ||
-- | ||
2.33.0 | ||
|
60 changes: 60 additions & 0 deletions
60
...on/recipes-devtools/python/python3-pillow/0001-Restrict-builtins-for-ImageMath.eval.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
From 8531b01d6cdf0b70f256f93092caa2a5d91afc11 Mon Sep 17 00:00:00 2001 | ||
From: Andrew Murray <[email protected]> | ||
Date: Sun, 2 Jan 2022 17:23:49 +1100 | ||
Subject: [PATCH] Restrict builtins for ImageMath.eval | ||
|
||
CVE: CVE-2022-22817 | ||
|
||
Upstream-Status: Backport | ||
(https://github.com/python-pillow/Pillow/pull/5923/commits/8531b01d6cdf0b70f256f93092caa2a5d91afc11) | ||
|
||
Signed-off-by: Trevor Gamblin <[email protected]> | ||
|
||
--- | ||
Tests/test_imagemath.py | 7 +++++++ | ||
src/PIL/ImageMath.py | 7 ++++++- | ||
2 files changed, 13 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/Tests/test_imagemath.py b/Tests/test_imagemath.py | ||
index e7afd1ab..25811aa8 100644 | ||
--- a/Tests/test_imagemath.py | ||
+++ b/Tests/test_imagemath.py | ||
@@ -1,3 +1,5 @@ | ||
+import pytest | ||
+ | ||
from PIL import Image, ImageMath | ||
|
||
|
||
@@ -50,6 +52,11 @@ def test_ops(): | ||
assert pixel(ImageMath.eval("float(B)**33", images)) == "F 8589934592.0" | ||
|
||
|
||
+def test_prevent_exec(): | ||
+ with pytest.raises(ValueError): | ||
+ ImageMath.eval("exec('pass')") | ||
+ | ||
+ | ||
def test_logical(): | ||
assert pixel(ImageMath.eval("not A", images)) == 0 | ||
assert pixel(ImageMath.eval("A and B", images)) == "L 2" | ||
diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py | ||
index 7f9c88e1..06bea800 100644 | ||
--- a/src/PIL/ImageMath.py | ||
+++ b/src/PIL/ImageMath.py | ||
@@ -246,7 +246,12 @@ def eval(expression, _dict={}, **kw): | ||
if hasattr(v, "im"): | ||
args[k] = _Operand(v) | ||
|
||
- out = builtins.eval(expression, args) | ||
+ code = compile(expression, "<string>", "eval") | ||
+ for name in code.co_names: | ||
+ if name not in args and name != "abs": | ||
+ raise ValueError(f"'{name}' not allowed") | ||
+ | ||
+ out = builtins.eval(expression, {"__builtins": {"abs": abs}}, args) | ||
try: | ||
return out.im | ||
except AttributeError: | ||
-- | ||
2.33.0 | ||
|
43 changes: 43 additions & 0 deletions
43
...-python/recipes-devtools/python/python3-pillow/0001-Use-snprintf-instead-of-sprintf.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
From 518ee3722a99d7f7d890db82a20bd81c1c0327fb Mon Sep 17 00:00:00 2001 | ||
From: Andrew Murray <[email protected]> | ||
Date: Wed, 30 Jun 2021 23:47:10 +1000 | ||
Subject: [PATCH 1/1] Use snprintf instead of sprintf | ||
|
||
Fix CVE-2021-34552. | ||
|
||
commit 518ee3722a99d7f7d890db82a20bd81c1c0327fb (unmodified) | ||
|
||
Upstream-Status: Backport | ||
Signed-off-by: Joe Slater <[email protected]> | ||
|
||
--- | ||
src/libImaging/Convert.c | 5 +++-- | ||
1 file changed, 3 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c | ||
index 1fa74a13b..9012cfcd7 100644 | ||
--- a/src/libImaging/Convert.c | ||
+++ b/src/libImaging/Convert.c | ||
@@ -1595,7 +1595,7 @@ convert( | ||
return (Imaging)ImagingError_ValueError("conversion not supported"); | ||
#else | ||
static char buf[100]; | ||
- sprintf(buf, "conversion from %.10s to %.10s not supported", imIn->mode, mode); | ||
+ snprintf(buf, 100, "conversion from %.10s to %.10s not supported", imIn->mode, mode); | ||
return (Imaging)ImagingError_ValueError(buf); | ||
#endif | ||
} | ||
@@ -1645,8 +1645,9 @@ ImagingConvertTransparent(Imaging imIn, const char *mode, int r, int g, int b) { | ||
#else | ||
{ | ||
static char buf[100]; | ||
- sprintf( | ||
+ snprintf( | ||
buf, | ||
+ 100, | ||
"conversion from %.10s to %.10s not supported in convert_transparent", | ||
imIn->mode, | ||
mode); | ||
-- | ||
2.29.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
From 9f3073bf6a7c7c51bb49d25f65c8f75cc704a5ee Mon Sep 17 00:00:00 2001 | ||
From: Hongxu Jia <hongxu.jia@windriver.com> | ||
Date: Mon, 18 Mar 2019 23:23:55 -0400 | ||
From 27bfa4028453dc79a72569823e97da8fd1994ffc Mon Sep 17 00:00:00 2001 | ||
From: Leon Anavi <leon.anavi@konsulko.com> | ||
Date: Tue, 1 Sep 2020 11:53:53 +0000 | ||
Subject: [PATCH] explicitly set compile options | ||
|
||
OE does not support to install egg package, so | ||
|
@@ -10,18 +10,19 @@ explicitly set build_ext options for oe-core's | |
Upstream-Status: Inappropriate [oe specific] | ||
|
||
Signed-off-by: Hongxu Jia <[email protected]> | ||
Signed-off-by: Leon Anavi <[email protected]> | ||
--- | ||
setup.cfg | 12 ++++++++++++ | ||
1 file changed, 12 insertions(+) | ||
|
||
diff --git a/setup.cfg b/setup.cfg | ||
index 3ab2e127..e92615f3 100644 | ||
index 19979cf7..ed27dfe1 100644 | ||
--- a/setup.cfg | ||
+++ b/setup.cfg | ||
@@ -4,3 +4,15 @@ test=pytest | ||
[flake8] | ||
extend-ignore = E203, W503 | ||
max-line-length = 88 | ||
@@ -11,3 +11,15 @@ multi_line_output = 3 | ||
[tool:pytest] | ||
addopts = -ra --color=yes | ||
testpaths = Tests | ||
+ | ||
+[build_ext] | ||
+disable-platform-guessing = 1 | ||
|
@@ -35,5 +36,5 @@ index 3ab2e127..e92615f3 100644 | |
+disable-webpmux = 1 | ||
+disable-imagequant = 1 | ||
-- | ||
2.20.1 | ||
2.17.1 | ||
|
Oops, something went wrong.