e_info_server: fixed division by zero accepted/tizen/4.0/unified/20180115.073411 submit/tizen_4.0/20180115.020453 tizen_4.0.IoT.p2_release
authorGwanglim Lee <gl77.lee@samsung.com>
Mon, 15 Jan 2018 01:44:30 +0000 (10:44 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 15 Jan 2018 02:03:28 +0000 (11:03 +0900)
Change-Id: I9b043882e6c5c082914b3da8787fea07aa97b7b0

src/bin/e_info_server.c

index cd8000333e180550d78a8b6481fa978f825ade9d..67eae24bb1bea0fe165b597065e694841e770781 100644 (file)
@@ -3530,7 +3530,7 @@ _e_info_server_cb_buffer_change(void *data, int type, void *event)
    tbm_surface_h tbm_surface;
    struct wl_shm_buffer *shmbuffer = NULL;
    void *ptr;
-   int stride, w, h, rotation;
+   int stride, w, h, rotation, row, col;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON);
    EINA_SAFETY_ON_NULL_RETURN_VAL(ev->ec, ECORE_CALLBACK_PASS_ON);
@@ -3601,10 +3601,15 @@ _e_info_server_cb_buffer_change(void *data, int type, void *event)
              tdm_pos pos;
              int box_size = 20;
              int box = e_info_dump_mark_count * box_size;
-             int width = tbm_surface_get_width(tbm_surface);
-             int height = tbm_surface_get_height(tbm_surface);
-             int row = (((box / width) * box_size) % height);
-             int col = box % width;
+
+             w = tbm_surface_get_width(tbm_surface);
+             h = tbm_surface_get_height(tbm_surface);
+
+             EINA_SAFETY_ON_FALSE_RETURN_VAL((w != 0), ECORE_CALLBACK_PASS_ON);
+             EINA_SAFETY_ON_FALSE_RETURN_VAL((h != 0), ECORE_CALLBACK_PASS_ON);
+
+             row = (((box / w) * box_size) % h);
+             col = box % w;
 
              pos.x = col;
              pos.y = row;