[Bf-blender-cvs] [cd2d84d] master: Fix three issues reported by coverity in own recent code. Including two potential crashers.

Bastien Montagne noreply at git.blender.org
Sat Jan 10 22:55:37 CET 2015


Commit: cd2d84d91c5b6a11c72b0a5aaa7db914dbe9bdcd
Author: Bastien Montagne
Date:   Sat Jan 10 22:54:32 2015 +0100
Branches: master
https://developer.blender.org/rBcd2d84d91c5b6a11c72b0a5aaa7db914dbe9bdcd

Fix three issues reported by coverity in own recent code. Including two potential crashers.

===================================================================

M	source/blender/blenkernel/intern/mesh_remap.c
M	source/blender/blenkernel/intern/object_data_transfer.c
M	source/blender/editors/space_outliner/outliner_tree.c

===================================================================

diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index 73ddb18..1deb7cf 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -1422,7 +1422,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
 				}
 
 				if (best_island_index != -1 && isld_steps_src) {
-					best_island = island_store.islands[best_island_index];
+					best_island = use_islands ? island_store.islands[best_island_index] : NULL;
 					as_graph = &as_graphdata[best_island_index];
 					poly_island_index_map = (int *)as_graph->custom_data;
 					BLI_astar_solution_init(as_graph, &as_solution, false);
@@ -1488,7 +1488,8 @@ void BKE_mesh_remap_calc_loops_from_dm(
 											BLI_space_transform_apply(space_transform, tmp_co);
 										}
 
-										pidx_src = best_island->indices[last_valid_pidx_isld_src];
+										pidx_src = use_islands ? best_island->indices[last_valid_pidx_isld_src] :
+										                         last_valid_pidx_isld_src;
 										mp_src = &polys_src[pidx_src];
 										ml_src = &loops_src[mp_src->loopstart];
 										for (j = 0; j < mp_src->totloop; j++, ml_src++) {
@@ -1564,7 +1565,8 @@ void BKE_mesh_remap_calc_loops_from_dm(
 											BLI_space_transform_apply(space_transform, tmp_co);
 										}
 
-										pidx_src = best_island->indices[last_valid_pidx_isld_src];
+										pidx_src = use_islands ? best_island->indices[last_valid_pidx_isld_src] :
+										                         last_valid_pidx_isld_src;
 										mp_src = &polys_src[pidx_src];
 
 										/* Create that one on demand. */
diff --git a/source/blender/blenkernel/intern/object_data_transfer.c b/source/blender/blenkernel/intern/object_data_transfer.c
index 71320fe..78a293c 100644
--- a/source/blender/blenkernel/intern/object_data_transfer.c
+++ b/source/blender/blenkernel/intern/object_data_transfer.c
@@ -367,6 +367,17 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(
 	int idx_dst, tot_dst = CustomData_number_of_layers(cd_dst, cddata_type);
 	bool *data_dst_to_delete = NULL;
 
+	if (!use_layers_src) {
+		/* No source at all, we can only delete all dest if requested... */
+		if (use_delete) {
+			idx_dst = tot_dst;
+			while (idx_dst--) {
+				CustomData_free_layer(cd_dst, cddata_type, num_elem_dst, idx_dst);
+			}
+		}
+		return true;
+	}
+
 	switch (tolayers) {
 		case DT_LAYERS_INDEX_DST:
 			idx_dst = tot_dst;
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index c6a6b8f..4aa36da 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1398,9 +1398,9 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
 		search_string = soops->search_string;
 	}
 	else {
-		search_string = search_buff;
 		/* Implicitly add heading/trailing wildcards if needed. */
-		BLI_strncpy_ensure_pad(search_string, soops->search_string, '*', sizeof(search_string));
+		BLI_strncpy_ensure_pad(search_buff, soops->search_string, '*', sizeof(search_buff));
+		search_string = search_buff;
 	}
 
 	for (te = lb->first; te; te = ten) {




More information about the Bf-blender-cvs mailing list