forked from QubesOS/qubes-vmm-xen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpatch-0001-python-check-return-value-of-PyErr_NewException.patch
50 lines (43 loc) · 1.67 KB
/
patch-0001-python-check-return-value-of-PyErr_NewException.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From c3798011e1c3860d0e35243546f9e542e69e76e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
Date: Wed, 22 Feb 2017 15:56:55 +0100
Subject: [PATCH 1/7] python: check return value of PyErr_NewException
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Invisible Things Lab
Cc: Marek Marczykowski-Górecki <[email protected]>
Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
tools/python/xen/lowlevel/xc/xc.c | 4 ++++
tools/python/xen/lowlevel/xs/xs.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 39be1d5..7fbead5 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -2735,6 +2735,10 @@ PyMODINIT_FUNC initxc(void)
return;
xc_error_obj = PyErr_NewException(PKG ".Error", PyExc_RuntimeError, NULL);
+ if (xc_error_obj == NULL) {
+ Py_DECREF(m);
+ return;
+ }
zero = PyInt_FromLong(0);
/* KAF: This ensures that we get debug output in a timely manner. */
diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
index a86edbe..5772f4b 100644
--- a/tools/python/xen/lowlevel/xs/xs.c
+++ b/tools/python/xen/lowlevel/xs/xs.c
@@ -987,6 +987,10 @@ PyMODINIT_FUNC initxs(void)
return;
xs_error = PyErr_NewException(PKG ".Error", PyExc_RuntimeError, NULL);
+ if (xs_error == NULL) {
+ Py_DECREF(m);
+ return;
+ }
Py_INCREF(&xshandle_type);
PyModule_AddObject(m, CLS, (PyObject *)&xshandle_type);
--
2.7.4