[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

PATCH [1/5]: pyblock: Check entries of the table list have the correct type



Check entries of the table list have the correct type.
---
 dm.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dm.c b/dm.c
index f279cb0..517e2fd 100644
--- a/dm.c
+++ b/dm.c
@@ -901,6 +901,13 @@ pydm_map_create(PydmMapObject *map, PyObject *table)
 		PydmTableObject *row =
 			(PydmTableObject *)PyList_GET_ITEM(table, i);

+		if (!PyObject_IsInstance((PyObject *)row,
+					 (PyObject *)&PydmTable_Type)) {
+			PyErr_SetString(PyExc_ValueError,
+				"invalid table type in table list");
+			dm_task_destroy(task);
+			return -1;
+		}
 		dm_task_add_target(task, row->start, row->size,
 				   row->type, row->params);
 		python_error_destroy_task(task, -1);
--
1.6.1.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]