diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2013-08-26 17:32:09 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2013-10-28 15:47:14 +0900 |
commit | 45456f8cf0a35bc997f2edd435ff34ec9f6abb81 (patch) | |
tree | db2c21f7bcb994fae5d592550a4f3214e02e8dad /src/lib/evas/cserve2 | |
parent | ca44473f184c95b88a2dadc02e85bb0806236c05 (diff) |
evas/cserve2: Fix crashes in E17/cserve2
When remapping the glyph data buffer, we need to reposition
the glyph pointers as well.
Diffstat (limited to 'src/lib/evas/cserve2')
-rw-r--r-- | src/lib/evas/cserve2/evas_cs2_client.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c index cc5458ad02..4a005215ad 100644 --- a/src/lib/evas/cserve2/evas_cs2_client.c +++ b/src/lib/evas/cserve2/evas_cs2_client.c | |||
@@ -1365,6 +1365,8 @@ _glyph_map_remap_check(Glyph_Map *map) | |||
1365 | if (eina_file_refresh(map->mempool.f) | 1365 | if (eina_file_refresh(map->mempool.f) |
1366 | || (eina_file_size_get(map->mempool.f) != (size_t) map->mempool.size)) | 1366 | || (eina_file_size_get(map->mempool.f) != (size_t) map->mempool.size)) |
1367 | { | 1367 | { |
1368 | CS_Glyph_Out *gl; | ||
1369 | |||
1368 | WRN("Glyph pool has been resized."); | 1370 | WRN("Glyph pool has been resized."); |
1369 | eina_file_map_free(map->mempool.f, map->mempool.data); | 1371 | eina_file_map_free(map->mempool.f, map->mempool.data); |
1370 | map->mempool.data = eina_file_map_all(map->mempool.f, EINA_FILE_RANDOM); | 1372 | map->mempool.data = eina_file_map_all(map->mempool.f, EINA_FILE_RANDOM); |
@@ -1373,6 +1375,17 @@ _glyph_map_remap_check(Glyph_Map *map) | |||
1373 | else | 1375 | else |
1374 | map->mempool.size = 0; | 1376 | map->mempool.size = 0; |
1375 | changed = EINA_TRUE; | 1377 | changed = EINA_TRUE; |
1378 | |||
1379 | // Remap loaded glyphs | ||
1380 | EINA_CLIST_FOR_EACH_ENTRY(gl, &map->fe->map->glyphs, | ||
1381 | CS_Glyph_Out, map_entry) | ||
1382 | { | ||
1383 | if (map->mempool.data) | ||
1384 | gl->base.bitmap.buffer = (unsigned char *) | ||
1385 | map->mempool.data + gl->offset; | ||
1386 | else | ||
1387 | gl->base.bitmap.buffer = NULL; | ||
1388 | } | ||
1376 | } | 1389 | } |
1377 | 1390 | ||
1378 | map->index.generation_id = _index.generation_id; | 1391 | map->index.generation_id = _index.generation_id; |
@@ -2050,6 +2063,7 @@ _shared_image_entry_file_data_find(Image_Entry *ie) | |||
2050 | if (!fd->id) break; | 2063 | if (!fd->id) break; |
2051 | if (!fd->refcount) continue; | 2064 | if (!fd->refcount) continue; |
2052 | 2065 | ||
2066 | key = _shared_string_get(fd->key); | ||
2053 | file = _shared_string_get(fd->path); | 2067 | file = _shared_string_get(fd->path); |
2054 | if (!file) | 2068 | if (!file) |
2055 | { | 2069 | { |
@@ -2058,7 +2072,11 @@ _shared_image_entry_file_data_find(Image_Entry *ie) | |||
2058 | add_to_hash = EINA_FALSE; | 2072 | add_to_hash = EINA_FALSE; |
2059 | continue; | 2073 | continue; |
2060 | } | 2074 | } |
2061 | key = _shared_string_get(fd->key); | 2075 | |
2076 | // Note: The strings base pointer may change if the index grows | ||
2077 | if ((key < _index.strings_entries.data) || | ||
2078 | (key > _index.strings_entries.data + _index.strings_entries.size)) | ||
2079 | key = _shared_string_get(fd->key); | ||
2062 | 2080 | ||
2063 | _shared_file_data_hkey_get(fd_hkey, file, key, PATH_MAX); | 2081 | _shared_file_data_hkey_get(fd_hkey, file, key, PATH_MAX); |
2064 | 2082 | ||
@@ -2385,6 +2403,12 @@ _shared_image_entry_image_data_find(Image_Entry *ie) | |||
2385 | add_to_hash = EINA_FALSE; | 2403 | add_to_hash = EINA_FALSE; |
2386 | continue; | 2404 | continue; |
2387 | } | 2405 | } |
2406 | |||
2407 | // Note: The strings base pointer may change if the index grows | ||
2408 | if ((key < _index.strings_entries.data) || | ||
2409 | (key > _index.strings_entries.data + _index.strings_entries.size)) | ||
2410 | key = _shared_string_get(fd->key); | ||
2411 | |||
2388 | keylen = key ? strlen(key) : 0; | 2412 | keylen = key ? strlen(key) : 0; |
2389 | filelen = strlen(file); | 2413 | filelen = strlen(file); |
2390 | 2414 | ||