Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-04 06:09:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-04 06:09:02 +0400
commit88e0bcfbe1407d6a93c2907bd6e9ce9d9d2976fa (patch)
tree4e536e32d19142f29e3da33ec9897d0c9c0f6941 /source/blender/python
parente583aa8e34c888aeda5ffd7828991c071356f65b (diff)
fix for crash in bmesh py api, was missing NULL checks for parsing sequences and had bad string formatting in exception.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/bmesh/bmesh_py_select.c12
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c14
2 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_select.c b/source/blender/python/bmesh/bmesh_py_select.c
index fd9f329f7c0..c5c66c0aaaa 100644
--- a/source/blender/python/bmesh/bmesh_py_select.c
+++ b/source/blender/python/bmesh/bmesh_py_select.c
@@ -65,7 +65,7 @@ static PyObject *bpy_bmeditselseq_active_get(BPy_BMEditSelSeq *self, void *UNUSE
}
static PyGetSetDef bpy_bmeditselseq_getseters[] = {
- {(char *)"active", (getter)bpy_bmeditselseq_active_get, (setter)NULL, (char *)bpy_bmeditselseq_active_doc, (void *)BM_VERTS_OF_MESH},
+ {(char *)"active", (getter)bpy_bmeditselseq_active_get, (setter)NULL, (char *)bpy_bmeditselseq_active_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -228,21 +228,21 @@ static int bpy_bmeditselseq_contains(BPy_BMEditSelSeq *self, PyObject *value)
}
static PySequenceMethods bpy_bmeditselseq_as_sequence = {
- (lenfunc)bpy_bmeditselseq_length, /* sq_length */
+ (lenfunc)bpy_bmeditselseq_length, /* sq_length */
NULL, /* sq_concat */
NULL, /* sq_repeat */
- (ssizeargfunc)bpy_bmeditselseq_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
+ (ssizeargfunc)bpy_bmeditselseq_subscript_int,/* sq_item */ /* Only set this so PySequence_Check() returns True */
NULL, /* sq_slice */
(ssizeobjargproc)NULL, /* sq_ass_item */
NULL, /* *was* sq_ass_slice */
- (objobjproc)bpy_bmeditselseq_contains, /* sq_contains */
+ (objobjproc)bpy_bmeditselseq_contains, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods bpy_bmeditselseq_as_mapping = {
- (lenfunc)bpy_bmeditselseq_length, /* mp_length */
- (binaryfunc)bpy_bmeditselseq_subscript, /* mp_subscript */
+ (lenfunc)bpy_bmeditselseq_length, /* mp_length */
+ (binaryfunc)bpy_bmeditselseq_subscript, /* mp_subscript */
(objobjargproc)NULL, /* mp_ass_subscript */
};
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 757f1f2ed90..5dc4e94c98a 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -839,6 +839,10 @@ static PyObject *bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *ar
&vert_seq_len, &BPy_BMVert_Type,
TRUE, TRUE, "BMVert.copy_from_vert_interp(...)");
+ if (vert_array == NULL) {
+ return NULL;
+ }
+
BM_data_interp_from_verts(bm, vert_array[0], vert_array[1], self->v, CLAMPIS(fac, 0.0f, 1.0f));
PyMem_FREE(vert_array);
@@ -1279,6 +1283,10 @@ static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
&vert_seq_len, &BPy_BMVert_Type,
TRUE, TRUE, "edges.new(...)");
+ if (vert_array == NULL) {
+ return NULL;
+ }
+
if (BM_edge_exists(vert_array[0], vert_array[1])) {
PyErr_SetString(PyExc_ValueError,
"edges.new(): this edge exists");
@@ -1342,6 +1350,10 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
&vert_seq_len, &BPy_BMVert_Type,
TRUE, TRUE, "faces.new(...)");
+ if (vert_array == NULL) {
+ return NULL;
+ }
+
/* check if the face exists */
if (BM_face_exists(bm, vert_array, vert_seq_len, NULL)) {
PyErr_SetString(PyExc_ValueError,
@@ -2600,7 +2612,7 @@ void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_
if (Py_TYPE(item) != type) {
PyErr_Format(PyExc_TypeError,
- "%s: expected '%.200', not '%.200s'",
+ "%s: expected '%.200s', not '%.200s'",
error_prefix, type->tp_name, Py_TYPE(item)->tp_name);
goto err_cleanup;
}