summaryrefslogtreecommitdiff
path: root/src/lib/evas/cserve2
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-10-29 13:54:15 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-29 15:08:14 +0900
commit10f80df01825066987452b11a9ec785555540c64 (patch)
tree0c3638f3c40ddca5f80b64e20f414d97c10a5c6d /src/lib/evas/cserve2
parent73c2ae44e0ae7404c64e2da1c0220301392a2220 (diff)
evas/cserve2: Fix new Coverity issues
Nothing extraordinary here. Most potential crashes are extremely unlikely. - Fix CID 1113444 - Fix CID 1113442 - Fix CID 1113441 (Logically dead code, can not be NULL) - Fix CID 1113440: Explicit null dereferenced This is actually an impossible situation. Fixed by checking for nullity and printing out some error messages instead of just crashing. - Fix CID 1113439: Dereference after null check Logically impossible code as both idxpath and datapath must be either set or null at the same time. Change the if logic to tell Coverity there's no bug. - Fix CID 1113438 (Argument cannot be negative) Fix wrong check of return value from shm_open. - Fix CID 1113437 (Argument cannot be negative) Fix wrong check of return value from shm_open. - Fix CID 1113436 (Dereference null return value) This case really shouldn't happen. But the extra check does not hurt. - Fix CID 1113435 (Dereference before null check) Check for nullity after map open. - Fix CID 1113434 (Extra sizeof expression) Debug buggy debug tool :) - Fix CID 1113433 (Uninitialized scalar variable) Insignificant issue: only prints wrong debug logs :) - Fix CID 1113431 (Uninitialized scalar value) Check if (!found) only to print out logs. Not a big deal if found was invalid. - Fix CID 1039462 (Logically dead code)
Diffstat (limited to 'src/lib/evas/cserve2')
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index 67c597a0cf..5410b0b212 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -545,7 +545,7 @@ _server_dispatch(Eina_Bool *failed)
545 Eina_List *l, *l_next; 545 Eina_List *l, *l_next;
546 Client_Request *cr; 546 Client_Request *cr;
547 Msg_Base *msg; 547 Msg_Base *msg;
548 Eina_Bool found; 548 Eina_Bool found = EINA_FALSE;
549 549
550 msg = _server_read(&size); 550 msg = _server_read(&size);
551 if (!msg) 551 if (!msg)
@@ -1691,8 +1691,9 @@ _glyph_map_remap_check(Glyph_Map *map, const char *idxpath, const char *datapath
1691 // Note: Since the shm name contains cserve2's PID it should most likely 1691 // Note: Since the shm name contains cserve2's PID it should most likely
1692 // always change in case of crash/restart 1692 // always change in case of crash/restart
1693 1693
1694 if ((datapath && strcmp(datapath, map->mempool.path)) 1694 if (datapath && idxpath &&
1695 || (idxpath && strcmp(idxpath, map->index.path))) 1695 ((strncmp(datapath, map->mempool.path, SHARED_BUFFER_PATH_MAX) != 0) ||
1696 (strncmp(idxpath, map->index.path, SHARED_BUFFER_PATH_MAX) != 0)))
1696 { 1697 {
1697 CS_Glyph_Out *gl, *cursor; 1698 CS_Glyph_Out *gl, *cursor;
1698 1699
@@ -1735,7 +1736,13 @@ _glyph_map_remap_check(Glyph_Map *map, const char *idxpath, const char *datapath
1735 else 1736 else
1736 { 1737 {
1737 gl->sb = oldbuf; 1738 gl->sb = oldbuf;
1738 EINA_REFCOUNT_REF(gl->sb); 1739 if (gl->sb)
1740 EINA_REFCOUNT_REF(gl->sb);
1741 else
1742 {
1743 ERR("Glyph pool can not be remapped! (invalid refs)");
1744 eina_clist_remove(&gl->map_entry);
1745 }
1739 } 1746 }
1740 } 1747 }
1741 1748
@@ -1824,11 +1831,13 @@ _font_entry_glyph_map_rebuild_check(Font_Entry *fe, Font_Hint_Flags hints)
1824 if (!idxpath || !datapath) return -1; 1831 if (!idxpath || !datapath) return -1;
1825 1832
1826 fe->map =_glyph_map_open(fe, idxpath, datapath); 1833 fe->map =_glyph_map_open(fe, idxpath, datapath);
1834 if (!fe->map) return -1;
1835
1827 changed = EINA_TRUE; 1836 changed = EINA_TRUE;
1828 } 1837 }
1829 1838
1830 changed |= _glyph_map_remap_check(fe->map, idxpath, datapath); 1839 changed |= _glyph_map_remap_check(fe->map, idxpath, datapath);
1831 if (changed && fe->map && fe->map->index.data && fe->map->mempool.data) 1840 if (changed && fe->map->index.data && fe->map->mempool.data)
1832 { 1841 {
1833 CS_Glyph_Out *gl; 1842 CS_Glyph_Out *gl;
1834 const Glyph_Data *gd; 1843 const Glyph_Data *gd;