diff options
Diffstat (limited to 'meta/recipes-devtools/python/python/0001-2.7-bpo-34623-Use-XML_SetHashSalt-in-_elementtree-GH.patch')
-rw-r--r-- | meta/recipes-devtools/python/python/0001-2.7-bpo-34623-Use-XML_SetHashSalt-in-_elementtree-GH.patch | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/meta/recipes-devtools/python/python/0001-2.7-bpo-34623-Use-XML_SetHashSalt-in-_elementtree-GH.patch b/meta/recipes-devtools/python/python/0001-2.7-bpo-34623-Use-XML_SetHashSalt-in-_elementtree-GH.patch deleted file mode 100644 index 3c0d662296..0000000000 --- a/meta/recipes-devtools/python/python/0001-2.7-bpo-34623-Use-XML_SetHashSalt-in-_elementtree-GH.patch +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | From 3ffc80959f01f9fde548f1632694b9f950c2dd7c Mon Sep 17 00:00:00 2001 | ||
2 | From: Christian Heimes <christian@python.org> | ||
3 | Date: Tue, 18 Sep 2018 15:13:09 +0200 | ||
4 | Subject: [PATCH] [2.7] bpo-34623: Use XML_SetHashSalt in _elementtree | ||
5 | (GH-9146) (GH-9394) | ||
6 | |||
7 | The C accelerated _elementtree module now initializes hash randomization | ||
8 | salt from _Py_HashSecret instead of libexpat's default CPRNG. | ||
9 | |||
10 | Signed-off-by: Christian Heimes <christian@python.org> | ||
11 | |||
12 | https://bugs.python.org/issue34623. | ||
13 | (cherry picked from commit cb5778f00ce48631c7140f33ba242496aaf7102b) | ||
14 | |||
15 | Co-authored-by: Christian Heimes <christian@python.org> | ||
16 | |||
17 | |||
18 | |||
19 | https://bugs.python.org/issue34623 | ||
20 | |||
21 | Upstream-Status: Backport | ||
22 | CVE: CVE-2018-14647 | ||
23 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
24 | --- | ||
25 | Include/pyexpat.h | 4 +++- | ||
26 | Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst | 2 ++ | ||
27 | Modules/_elementtree.c | 5 +++++ | ||
28 | Modules/pyexpat.c | 5 +++++ | ||
29 | 4 files changed, 15 insertions(+), 1 deletion(-) | ||
30 | create mode 100644 Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst | ||
31 | |||
32 | diff --git a/Include/pyexpat.h b/Include/pyexpat.h | ||
33 | index 5340ef5..3fc5fa5 100644 | ||
34 | --- a/Include/pyexpat.h | ||
35 | +++ b/Include/pyexpat.h | ||
36 | @@ -3,7 +3,7 @@ | ||
37 | |||
38 | /* note: you must import expat.h before importing this module! */ | ||
39 | |||
40 | -#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0" | ||
41 | +#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1" | ||
42 | #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" | ||
43 | |||
44 | struct PyExpat_CAPI | ||
45 | @@ -43,6 +43,8 @@ struct PyExpat_CAPI | ||
46 | XML_Parser parser, XML_UnknownEncodingHandler handler, | ||
47 | void *encodingHandlerData); | ||
48 | void (*SetUserData)(XML_Parser parser, void *userData); | ||
49 | + /* might be none for expat < 2.1.0 */ | ||
50 | + int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt); | ||
51 | /* always add new stuff to the end! */ | ||
52 | }; | ||
53 | |||
54 | diff --git a/Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst b/Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst | ||
55 | new file mode 100644 | ||
56 | index 0000000..31ad92e | ||
57 | --- /dev/null | ||
58 | +++ b/Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst | ||
59 | @@ -0,0 +1,2 @@ | ||
60 | +The C accelerated _elementtree module now initializes hash randomization | ||
61 | +salt from _Py_HashSecret instead of libexpat's default CSPRNG. | ||
62 | diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c | ||
63 | index 1d316a1..a19cbf7 100644 | ||
64 | --- a/Modules/_elementtree.c | ||
65 | +++ b/Modules/_elementtree.c | ||
66 | @@ -2574,6 +2574,11 @@ xmlparser(PyObject* self_, PyObject* args, PyObject* kw) | ||
67 | PyErr_NoMemory(); | ||
68 | return NULL; | ||
69 | } | ||
70 | + /* expat < 2.1.0 has no XML_SetHashSalt() */ | ||
71 | + if (EXPAT(SetHashSalt) != NULL) { | ||
72 | + EXPAT(SetHashSalt)(self->parser, | ||
73 | + (unsigned long)_Py_HashSecret.prefix); | ||
74 | + } | ||
75 | |||
76 | ALLOC(sizeof(XMLParserObject), "create expatparser"); | ||
77 | |||
78 | diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c | ||
79 | index 2b4d312..1f8c0d7 100644 | ||
80 | --- a/Modules/pyexpat.c | ||
81 | +++ b/Modules/pyexpat.c | ||
82 | @@ -2042,6 +2042,11 @@ MODULE_INITFUNC(void) | ||
83 | capi.SetProcessingInstructionHandler = XML_SetProcessingInstructionHandler; | ||
84 | capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler; | ||
85 | capi.SetUserData = XML_SetUserData; | ||
86 | +#if XML_COMBINED_VERSION >= 20100 | ||
87 | + capi.SetHashSalt = XML_SetHashSalt; | ||
88 | +#else | ||
89 | + capi.SetHashSalt = NULL; | ||
90 | +#endif | ||
91 | |||
92 | /* export using capsule */ | ||
93 | capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL); | ||
94 | -- | ||
95 | 2.7.4 | ||
96 | |||