From d9e068a9e56903d2591c87e26993b0302973b668 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 10 Jan 2014 17:54:51 +0900 Subject: [PATCH] mapbuf - move index check into eo method and use fixed index size this also fixes CID 1141033 and CID 1141032 --- legacy/elementary/src/lib/elm_mapbuf.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/legacy/elementary/src/lib/elm_mapbuf.c b/legacy/elementary/src/lib/elm_mapbuf.c index 73ab347118..375b07b3ef 100644 --- a/legacy/elementary/src/lib/elm_mapbuf.c +++ b/legacy/elementary/src/lib/elm_mapbuf.c @@ -516,6 +516,11 @@ _point_color_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) Elm_Mapbuf_Smart_Data *sd = _pd; + if ((idx < 0) || (idx >= 4)) + { + ERR("idx value should be 0 ~ 4"); + return; + } *r = sd->colors[idx].r; *g = sd->colors[idx].g; *b = sd->colors[idx].b; @@ -527,14 +532,6 @@ elm_mapbuf_point_color_get(Evas_Object *obj, int idx, int *r, int *g, int *b, int *a) { ELM_MAPBUF_CHECK(obj); - ELM_MAPBUF_DATA_GET(obj, sd); - - if ((idx < 0) || (idx >= (int)(sizeof(sd->colors)/sizeof(sd->colors[0])))) - { - ERR("idx value should be 0 ~ %zd, mapbuf(%p)", - ((sizeof(sd->colors)/sizeof(sd->colors[0])) - 1), obj); - return; - } eo_do(obj, elm_obj_mapbuf_point_color_get(idx, r, g, b, a)); } @@ -550,6 +547,11 @@ _point_color_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list) Elm_Mapbuf_Smart_Data *sd = _pd; + if ((idx < 0) || (idx >= 4)) + { + ERR("idx value should be 0 ~ 4"); + return; + } sd->colors[idx].r = r; sd->colors[idx].g = g; sd->colors[idx].b = b; @@ -563,14 +565,6 @@ elm_mapbuf_point_color_set(Evas_Object *obj, int idx, int r, int g, int b, int a) { ELM_MAPBUF_CHECK(obj); - ELM_MAPBUF_DATA_GET(obj, sd); - - if ((idx < 0) || (idx >= (int)(sizeof(sd->colors)/sizeof(sd->colors[0])))) - { - ERR("idx value should be 0 ~ %zd, mapbuf(%p)", - ((sizeof(sd->colors)/sizeof(sd->colors[0])) - 1), obj); - return; - } eo_do(obj, elm_obj_mapbuf_point_color_set(idx, r, g, b, a)); }