summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-07-04 02:23:17 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-08-21 16:40:32 +0200
commit12354260693590916c4c80f1c5369aa77ac77f30 (patch)
tree4ca30c2225c6e2b3253d2bb0b728eceec7b64ccd
parentd194eeeba9e6a54bdd1ff7d406b2909261e34f08 (diff)
efl: prevent segv while interpolating empty shape.
-rw-r--r--src/lib/efl/interfaces/efl_gfx_shape.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c
index efbc9d5ea9..a01c62d976 100644
--- a/src/lib/efl/interfaces/efl_gfx_shape.c
+++ b/src/lib/efl/interfaces/efl_gfx_shape.c
@@ -255,6 +255,7 @@ _efl_gfx_shape_equal_commands_internal(Efl_Gfx_Shape_Data *a,
255 unsigned int i; 255 unsigned int i;
256 256
257 if (a->commands_count != b->commands_count) return EINA_FALSE; 257 if (a->commands_count != b->commands_count) return EINA_FALSE;
258 if (a->commands_count <= 0) return EINA_TRUE;
258 259
259 for (i = 0; a->commands[i] == b->commands[i] && 260 for (i = 0; a->commands[i] == b->commands[i] &&
260 a->commands[i] != EFL_GFX_PATH_COMMAND_TYPE_END; i++) 261 a->commands[i] != EFL_GFX_PATH_COMMAND_TYPE_END; i++)
@@ -337,21 +338,24 @@ _efl_gfx_shape_interpolate(Eo *obj, Efl_Gfx_Shape_Data *pd,
337 if (!pts && from_pd->points_count) return EINA_FALSE; 338 if (!pts && from_pd->points_count) return EINA_FALSE;
338 pd->points = pts; 339 pd->points = pts;
339 340
340 memcpy(cmds, from_pd->commands, 341 if (cmds)
341 sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count); 342 {
343 memcpy(cmds, from_pd->commands,
344 sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count);
342 345
343 to_pts = to_pd->points; 346 to_pts = to_pd->points;
344 from_pts = from_pd->points; 347 from_pts = from_pd->points;
345 348
346 for (i = 0; cmds[i] != EFL_GFX_PATH_COMMAND_TYPE_END; i++) 349 for (i = 0; cmds[i] != EFL_GFX_PATH_COMMAND_TYPE_END; i++)
347 for (j = 0; j < _efl_gfx_path_command_length(cmds[i]); j++) 350 for (j = 0; j < _efl_gfx_path_command_length(cmds[i]); j++)
348 { 351 {
349 *pts = interpolate(*from_pts, *to_pts, pos_map); 352 *pts = interpolate(*from_pts, *to_pts, pos_map);
350 353
351 pts++; 354 pts++;
352 from_pts++; 355 from_pts++;
353 to_pts++; 356 to_pts++;
354 } 357 }
358 }
355 359
356 pd->points_count = from_pd->points_count; 360 pd->points_count = from_pd->points_count;
357 pd->commands_count = from_pd->commands_count; 361 pd->commands_count = from_pd->commands_count;