From bd32015dfc13e2a31a250e7046036f81030cfb96 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 29 Dec 2015 15:56:24 +0900 Subject: [PATCH] Eet: Fail gracefully on invalid input Consider infinity and NaN as invalid input for put_float and put_double, since the underlying convert function can't process them. This fixes potential errors with incomplete / invalid evas 3d models --- src/lib/eet/eet_data.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/eet/eet_data.c b/src/lib/eet/eet_data.c index ad2fe47090..eb5a44aba2 100644 --- a/src/lib/eet/eet_data.c +++ b/src/lib/eet/eet_data.c @@ -1018,7 +1018,8 @@ eet_data_put_float(Eet_Dictionary *ed, char buf[128]; int idx; - eina_convert_dtoa((double)(*(float *)src), buf); + if (!eina_convert_dtoa((double)(*(float *)src), buf)) + return NULL; if (!ed) { @@ -1094,7 +1095,8 @@ eet_data_put_double(Eet_Dictionary *ed, char buf[128]; int idx; - eina_convert_dtoa((double)(*(double *)src), buf); + if (!eina_convert_dtoa((double)(*(double *)src), buf)) + return NULL; if (!ed) {