summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-11-20 18:06:42 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-11-20 18:06:42 +0900
commitbf01751a1dd84702a5b18d2702f4bf6d7a5b2868 (patch)
treec837a99ada1aad86c668abecb56ef7c530e55865 /src
parentf86f394239a92983711f8a161b767f7231fad9d5 (diff)
elm - table - protect against invalid cell/row values (16bit overflow)
Diffstat (limited to 'src')
-rw-r--r--src/lib/elm_table.c39
-rw-r--r--src/lib/elm_table_legacy.h6
2 files changed, 45 insertions, 0 deletions
diff --git a/src/lib/elm_table.c b/src/lib/elm_table.c
index da487c386..7166fcc5b 100644
--- a/src/lib/elm_table.c
+++ b/src/lib/elm_table.c
@@ -343,6 +343,45 @@ _pack(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
343 int rowspan = va_arg(*list, int); 343 int rowspan = va_arg(*list, int);
344 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 344 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
345 345
346 if (col < 0)
347 {
348 ERR("col < 0");
349 return;
350 }
351 if (colspan < 1)
352 {
353 ERR("colspan < 1");
354 return;
355 }
356 if ((0xffff - col) < colspan)
357 {
358 ERR("col + colspan > 0xffff");
359 return;
360 }
361 if ((col + colspan) >= 0x7ffff)
362 {
363 WRN("col + colspan getting rather large (>32767)");
364 }
365 if (row < 0)
366 {
367 ERR("row < 0");
368 return;
369 }
370 if (rowspan < 1)
371 {
372 ERR("rowspan < 1");
373 return;
374 }
375 if ((0xffff - row) < rowspan)
376 {
377 ERR("row + rowspan > 0xffff");
378 return;
379 }
380 if ((row + rowspan) >= 0x7ffff)
381 {
382 WRN("row + rowspan getting rather large (>32767)");
383 }
384
346 elm_widget_sub_object_add(obj, subobj); 385 elm_widget_sub_object_add(obj, subobj);
347 evas_object_table_pack(wd->resize_obj, subobj, col, row, colspan, rowspan); 386 evas_object_table_pack(wd->resize_obj, subobj, col, row, colspan, rowspan);
348} 387}
diff --git a/src/lib/elm_table_legacy.h b/src/lib/elm_table_legacy.h
index 77dda3acc..27e06efd8 100644
--- a/src/lib/elm_table_legacy.h
+++ b/src/lib/elm_table_legacy.h
@@ -68,6 +68,12 @@ EAPI void elm_table_padding_get(const Evas_Object *obj, Evas_Coord *horizon
68 * a value of 0 for x and y, means the top left cell of the table, and a 68 * a value of 0 for x and y, means the top left cell of the table, and a
69 * value of 1 for w and h means @p subobj only takes that 1 cell. 69 * value of 1 for w and h means @p subobj only takes that 1 cell.
70 * 70 *
71 * Note that columns and rows only guarantee 16bit unsigned values at best.
72 * That means that col + colspan AND row + rowspan must fit inside 16bit
73 * unsigned values cleanly. You will be warned once values exceed 15bit
74 * storage, and attempting to use values not able to fit in 16bits will
75 * result in failure.
76 *
71 * @ingroup Table 77 * @ingroup Table
72 */ 78 */
73EAPI void elm_table_pack(Evas_Object *obj, Evas_Object *subobj, int col, int row, int colspan, int rowspan); 79EAPI void elm_table_pack(Evas_Object *obj, Evas_Object *subobj, int col, int row, int colspan, int rowspan);