diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-25 18:55:08 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-01-25 18:55:08 +0300 |
commit | 60663c8ec42f1cf0f527a42ea3c6ebbd9b4d3153 (patch) | |
tree | d6e7109c5d96b09ea848df2151ab13b65414a3d1 /source | |
parent | 9e56d75470acad4de30cc945f5ea988d0cf647c6 (diff) |
Fix various potential bugs from coverity reports (NULL dereference, negative number assigned to uint...).
Note: the wm_jobs needs proper fix, we cannot have that kind of inconsistencies in some 'public' API!
Diffstat (limited to 'source')
4 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c index 38391c84d29..b5f63588423 100644 --- a/source/blender/blenkernel/intern/object_deform.c +++ b/source/blender/blenkernel/intern/object_deform.c @@ -604,7 +604,8 @@ void BKE_object_defgroup_mirror_selection( bool *dg_flags_sel, int *r_dg_flags_sel_tot) { bDeformGroup *defgroup; - unsigned int i, i_mirr; + unsigned int i; + int i_mirr; for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) { if (dg_selection[i]) { diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 2ba07971424..e4e9976c10d 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -168,7 +168,7 @@ static void load_tex_task_cb_ex(void *userdata, void *UNUSED(userdata_chunck), c bool convert_to_linear = false; struct ColorSpace *colorspace = NULL; - if (mtex->tex->type == TEX_IMAGE && mtex->tex->ima) { + if (mtex->tex && mtex->tex->type == TEX_IMAGE && mtex->tex->ima) { ImBuf *tex_ibuf = BKE_image_pool_acquire_ibuf(mtex->tex->ima, &mtex->tex->iuser, pool); /* For consistency, sampling always returns color in linear space */ if (tex_ibuf && tex_ibuf->rect_float == NULL) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index f90df4ba45e..f245685abbd 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2081,9 +2081,6 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P bool use_face_sel; bool use_depth; - float (*blur_weight_func)(MDeformVert *, WeightPaintInfo *) = - wpd->do_multipaint ? wpaint_blur_weight_multi : wpaint_blur_weight_single; - const float pressure = RNA_float_get(itemptr, "pressure"); const float brush_size_pressure = BKE_brush_size_get(scene, brush) * (BKE_brush_use_size_pressure(scene, brush) ? pressure : 1.0f); @@ -2102,6 +2099,9 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P return; } + float (*blur_weight_func)(MDeformVert *, WeightPaintInfo *) = + wpd->do_multipaint ? wpaint_blur_weight_multi : wpaint_blur_weight_single; + vc = &wpd->vc; ob = vc->obact; me = ob->data; diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index 19b393baa3f..e445de27108 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -294,7 +294,7 @@ bool WM_jobs_is_running(wmJob *wm_job) bool WM_jobs_is_stopped(wmWindowManager *wm, void *owner) { wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY); - return wm_job->stop; + return wm_job ? wm_job->stop : true; /* XXX to be redesigned properly. */ } void *WM_jobs_customdata_get(wmJob *wm_job) |