From 5b4c032fb5dc73f2fc8fce124c32c59426cdbb25 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 8 Feb 2017 16:43:50 +0900 Subject: [PATCH] edje_cc - fix potential divide by 0 in info output if file size is 0 this will realistically never happen in a sane case... but its theoretically possible. fixes CID 1366923 --- src/bin/edje/edje_cc_out.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index 1d33bdd..fc456b8 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -786,6 +786,7 @@ data_thread_fonts(void *data, Ecore_Thread *thread EINA_UNUSED) int bytes = 0; char buf[EINA_PATH_MAX]; char buf2[EINA_PATH_MAX]; + size_t size; f = eina_file_open(fc->fn->file, 0); if (f) @@ -835,9 +836,10 @@ data_thread_fonts(void *data, Ecore_Thread *thread EINA_UNUSED) return; } + size = eina_file_size_get(f); INF("Wrote %9i bytes (%4iKb) for \"%s\" font entry \"%s\" compress: [real: %2.1f%%]", bytes, (bytes + 512) / 1024, buf, fc->fn->file, - 100 - (100 * (double)bytes) / ((double)(eina_file_size_get(f))) + 100 - (100 * (double)bytes) / ((double)((size > 0) ? size : 1)) ); eina_file_map_free(f, m); eina_file_close(f); -- 2.7.4