This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efl.
View the commit online.
commit 2d893836abaa1afa5e7872eb0944c56d6bb9f5ff
Author: Boris Faure <[email protected]>
AuthorDate: Mon Nov 9 10:31:12 2026 +0000
eina: keep strtod_c of zero with a huge exponent zero
An exponent past 308 makes the scale infinite, and eina_convert_strtod_c()
multiplied the mantissa by it even when the mantissa was zero, so 0e400
came back as NaN where strtod() gives 0.
---
src/lib/eina/eina_convert.c | 4 +++-
src/tests/eina/eina_test_convert.c | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/lib/eina/eina_convert.c b/src/lib/eina/eina_convert.c
index 6766525bde..d6609babfd 100644
--- a/src/lib/eina/eina_convert.c
+++ b/src/lib/eina/eina_convert.c
@@ -644,7 +644,9 @@ eina_convert_strtod_c(const char *nptr, char **endptr)
expo_part--;
}
- val = (minus_e == -1) ? (val / scale) : (val * scale);
+ /* 0 * inf would be NaN */
+ if (!eina_dbl_exact(val, 0.0))
+ val = (minus_e == -1) ? (val / scale) : (val * scale);
}
else if ((iter > nptr) && !isdigit(*(iter - 1)))
{
diff --git a/src/tests/eina/eina_test_convert.c b/src/tests/eina/eina_test_convert.c
index 7ea15223d4..7e27e81d2b 100644
--- a/src/tests/eina/eina_test_convert.c
+++ b/src/tests/eina/eina_test_convert.c
@@ -253,6 +253,9 @@ EFL_START_TEST(eina_convert_strtod_c_simple)
_eina_convert_strtod_c_check("1e4294967297");
_eina_convert_strtod_c_check("1e-4294967297");
_eina_convert_strtod_c_check("1e56789012345678901234567890");
+ /* zero times an infinite scale */
+ _eina_convert_strtod_c_check("0e400");
+ _eina_convert_strtod_c_check("-0.0e-400");
_eina_convert_strtod_c_check(" NaNfoo");
_eina_convert_strtod_c_check(" -INFfoo");
// this test isn't viable because libc actually fails the conversion (testing
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.