summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonki Kim <wonki_.kim@samsung.com>2020-08-06 00:46:24 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-08-06 10:34:28 +0200
commit3f4bcd02dc72701a686af602210c1ad13aef0f7f (patch)
treeff5119f389d935914e31839fe840aa280f9a231b
parente4651d8fe5518faa1acf145b1570ceaee4eac39d (diff)
edje_entry: fix a potentional error of null deref
this is a patch to fix a potentional error by null dereferencing. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D12087
-rw-r--r--src/lib/edje/edje_entry.c127
1 files changed, 65 insertions, 62 deletions
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index 1ed9091b09..442a5c6d38 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -1196,79 +1196,82 @@ _anchors_update(Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entry *en)
1196 free(sel); 1196 free(sel);
1197 an->sel = eina_list_remove_list(an->sel, an->sel); 1197 an->sel = eina_list_remove_list(an->sel, an->sel);
1198 } 1198 }
1199 Evas_Textblock_Rectangle *r, *r_last; 1199 if (range)
1200
1201 r = range->data;
1202 r_last = eina_list_last_data_get(range);
1203 if (r->y != r_last->y)
1204 {
1205 /* For multiple range */
1206 r->h = r->y + r_last->y + r_last->h;
1207 }
1208 /* For vertically layout entry */
1209 if (_is_anchors_outside_viewport(y, r->y, r->h, vy, tvh))
1210 {
1211 EINA_LIST_FREE(range, r)
1212 free(r);
1213 continue;
1214 }
1215 else
1216 { 1200 {
1217 /* XXX: Should consider for horizontal entry but has 1201 Evas_Textblock_Rectangle *r, *r_last;
1218 * very minimal usage. Probably we should get the min x
1219 * and max w for range and then decide whether it is in
1220 * the viewport or not. Unnecessary calculation for this
1221 * minimal usage. Please test with large number of anchors
1222 * after implementing it, if its needed to be.
1223 */
1224 }
1225 for (ll = range; ll; ll = eina_list_next(ll))
1226 {
1227 Evas_Object *ob;
1228 1202
1229 sel = calloc(1, sizeof(Sel)); 1203 r = range->data;
1230 if (!sel) 1204 r_last = eina_list_last_data_get(range);
1205 if (r->y != r_last->y)
1231 { 1206 {
1232 ERR("Running very low on memory"); 1207 /* For multiple range */
1233 break; 1208 r->h = r->y + r_last->y + r_last->h;
1234 } 1209 }
1235 an->sel = eina_list_append(an->sel, sel); 1210 /* For vertically layout entry */
1236 if (en->rp->part->source5) 1211 if (_is_anchors_outside_viewport(y, r->y, r->h, vy, tvh))
1237 { 1212 {
1238 ob = edje_object_add(ed->base.evas); 1213 EINA_LIST_FREE(range, r)
1239 edje_object_file_set(ob, ed->path, en->rp->part->source5); 1214 free(r);
1240 evas_object_smart_member_add(ob, smart); 1215 continue;
1241 evas_object_stack_below(ob, o);
1242 evas_object_clip_set(ob, clip);
1243 evas_object_pass_events_set(ob, EINA_TRUE);
1244 sel->obj_bg = ob;
1245 _edje_subobj_register(ed, sel->obj_bg);
1246 } 1216 }
1247 1217 else
1248 if (en->rp->part->source6) 1218 {
1219 /* XXX: Should consider for horizontal entry but has
1220 * very minimal usage. Probably we should get the min x
1221 * and max w for range and then decide whether it is in
1222 * the viewport or not. Unnecessary calculation for this
1223 * minimal usage. Please test with large number of anchors
1224 * after implementing it, if its needed to be.
1225 */
1226 }
1227 for (ll = range; ll; ll = eina_list_next(ll))
1249 { 1228 {
1250 ob = edje_object_add(ed->base.evas); 1229 Evas_Object *ob;
1251 edje_object_file_set(ob, ed->path, en->rp->part->source6); 1230
1231 sel = calloc(1, sizeof(Sel));
1232 if (!sel)
1233 {
1234 ERR("Running very low on memory");
1235 break;
1236 }
1237 an->sel = eina_list_append(an->sel, sel);
1238 if (en->rp->part->source5)
1239 {
1240 ob = edje_object_add(ed->base.evas);
1241 edje_object_file_set(ob, ed->path, en->rp->part->source5);
1242 evas_object_smart_member_add(ob, smart);
1243 evas_object_stack_below(ob, o);
1244 evas_object_clip_set(ob, clip);
1245 evas_object_pass_events_set(ob, EINA_TRUE);
1246 sel->obj_bg = ob;
1247 _edje_subobj_register(ed, sel->obj_bg);
1248 }
1249
1250 if (en->rp->part->source6)
1251 {
1252 ob = edje_object_add(ed->base.evas);
1253 edje_object_file_set(ob, ed->path, en->rp->part->source6);
1254 evas_object_smart_member_add(ob, smart);
1255 evas_object_stack_above(ob, o);
1256 evas_object_clip_set(ob, clip);
1257 evas_object_pass_events_set(ob, EINA_TRUE);
1258 sel->obj_fg = ob;
1259 _edje_subobj_register(ed, sel->obj_fg);
1260 }
1261
1262 ob = evas_object_rectangle_add(ed->base.evas);
1263 evas_object_color_set(ob, 0, 0, 0, 0);
1252 evas_object_smart_member_add(ob, smart); 1264 evas_object_smart_member_add(ob, smart);
1253 evas_object_stack_above(ob, o); 1265 evas_object_stack_above(ob, o);
1254 evas_object_clip_set(ob, clip); 1266 evas_object_clip_set(ob, clip);
1255 evas_object_pass_events_set(ob, EINA_TRUE); 1267 evas_object_repeat_events_set(ob, EINA_TRUE);
1256 sel->obj_fg = ob; 1268 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_anchor_mouse_down_cb, an);
1257 _edje_subobj_register(ed, sel->obj_fg); 1269 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_anchor_mouse_up_cb, an);
1270 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_anchor_mouse_move_cb, an);
1271 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_IN, _edje_anchor_mouse_in_cb, an);
1272 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_OUT, _edje_anchor_mouse_out_cb, an);
1273 sel->obj = ob;
1258 } 1274 }
1259
1260 ob = evas_object_rectangle_add(ed->base.evas);
1261 evas_object_color_set(ob, 0, 0, 0, 0);
1262 evas_object_smart_member_add(ob, smart);
1263 evas_object_stack_above(ob, o);
1264 evas_object_clip_set(ob, clip);
1265 evas_object_repeat_events_set(ob, EINA_TRUE);
1266 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_anchor_mouse_down_cb, an);
1267 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_anchor_mouse_up_cb, an);
1268 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_anchor_mouse_move_cb, an);
1269 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_IN, _edje_anchor_mouse_in_cb, an);
1270 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_OUT, _edje_anchor_mouse_out_cb, an);
1271 sel->obj = ob;
1272 } 1275 }
1273 } 1276 }
1274 1277