diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2015-07-04 02:23:17 +0200 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-08-21 16:40:32 +0200 |
commit | 12354260693590916c4c80f1c5369aa77ac77f30 (patch) | |
tree | 4ca30c2225c6e2b3253d2bb0b728eceec7b64ccd | |
parent | d194eeeba9e6a54bdd1ff7d406b2909261e34f08 (diff) | |
download | efl-12354260693590916c4c80f1c5369aa77ac77f30.tar.gz |
efl: prevent segv while interpolating empty shape.
-rw-r--r-- | src/lib/efl/interfaces/efl_gfx_shape.c | 28 |
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, unsigned int i; if (a->commands_count != b->commands_count) return EINA_FALSE; + if (a->commands_count <= 0) return EINA_TRUE; for (i = 0; a->commands[i] == b->commands[i] && 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, if (!pts && from_pd->points_count) return EINA_FALSE; pd->points = pts; - memcpy(cmds, from_pd->commands, - sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count); + if (cmds) + { + memcpy(cmds, from_pd->commands, + sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count); - to_pts = to_pd->points; - from_pts = from_pd->points; + to_pts = to_pd->points; + from_pts = from_pd->points; - for (i = 0; cmds[i] != EFL_GFX_PATH_COMMAND_TYPE_END; i++) - for (j = 0; j < _efl_gfx_path_command_length(cmds[i]); j++) - { - *pts = interpolate(*from_pts, *to_pts, pos_map); + for (i = 0; cmds[i] != EFL_GFX_PATH_COMMAND_TYPE_END; i++) + for (j = 0; j < _efl_gfx_path_command_length(cmds[i]); j++) + { + *pts = interpolate(*from_pts, *to_pts, pos_map); - pts++; - from_pts++; - to_pts++; - } + pts++; + from_pts++; + to_pts++; + } + } pd->points_count = from_pd->points_count; pd->commands_count = from_pd->commands_count; |