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>2013-07-15 03:41:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-15 03:41:33 +0400
commit3c4c2478b60602b179009c9da5c3aecb5bcd0632 (patch)
treeb1af308cfc7cd7c53412be64d02b1d94d25bc8a6 /source/blender/editors
parent878608d1cf62efa72208af619f9ed4750917868a (diff)
fix for own regression, face index ranges still need checking in some places.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c15
-rw-r--r--source/blender/editors/space_view3d/drawobject.c26
2 files changed, 33 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 7525b799067..cffcc738b5a 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -566,7 +566,12 @@ static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index)
{
drawEMTFMapped_userData *data = userData;
BMEditMesh *em = data->em;
- BMFace *efa = EDBM_face_at_index(em, index);
+ BMFace *efa;
+
+ if (UNLIKELY(index >= em->bm->totface))
+ return DM_DRAW_OPTION_NORMAL;
+
+ efa = EDBM_face_at_index(em, index);
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return DM_DRAW_OPTION_SKIP;
@@ -922,7 +927,13 @@ static int tex_mat_set_face_editmesh_cb(void *userData, int index)
/* editmode face hiding */
TexMatCallback *data = (TexMatCallback *)userData;
Mesh *me = (Mesh *)data->me;
- BMFace *efa = EDBM_face_at_index(me->edit_btmesh, index);
+ BMEditMesh *em = me->edit_btmesh;
+ BMFace *efa;
+
+ if (UNLIKELY(index >= em->bm->totface))
+ return DM_DRAW_OPTION_NORMAL;
+
+ efa = EDBM_face_at_index(em, index);
return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 54a3260439e..5c46040a2f9 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -3049,24 +3049,38 @@ static void draw_em_indices(BMEditMesh *em)
static DMDrawOption draw_em_fancy__setFaceOpts(void *userData, int index)
{
- BMFace *efa = EDBM_face_at_index(userData, index);
+ BMEditMesh *em = userData;
+ BMFace *efa;
+
+ if (UNLIKELY(index >= em->bm->totface))
+ return DM_DRAW_OPTION_NORMAL;
+ efa = EDBM_face_at_index(em, index);
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
GPU_enable_material(efa->mat_nr + 1, NULL);
return DM_DRAW_OPTION_NORMAL;
}
- else
+ else {
return DM_DRAW_OPTION_SKIP;
+ }
}
static DMDrawOption draw_em_fancy__setGLSLFaceOpts(void *userData, int index)
{
- BMFace *efa = EDBM_face_at_index(userData, index);
+ BMEditMesh *em = userData;
+ BMFace *efa;
- if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
- return DM_DRAW_OPTION_SKIP;
- else
+ if (UNLIKELY(index >= em->bm->totface))
return DM_DRAW_OPTION_NORMAL;
+
+ efa = EDBM_face_at_index(em, index);
+
+ if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+ return DM_DRAW_OPTION_NORMAL;
+ }
+ else {
+ return DM_DRAW_OPTION_SKIP;
+ }
}
static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,