summaryrefslogtreecommitdiff
path: root/fitz/base_string.c
diff options
context:
space:
mode:
Diffstat (limited to 'fitz/base_string.c')
-rw-r--r--fitz/base_string.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fitz/base_string.c b/fitz/base_string.c
index 7587f96b..8ed08911 100644
--- a/fitz/base_string.c
+++ b/fitz/base_string.c
@@ -248,10 +248,11 @@ float fz_atof(const char *s)
* as we convert to a float. */
errno = 0;
d = strtod(s, NULL);
- if (errno == ERANGE || d > FLT_MAX || d < -FLT_MAX) {
+ if (errno == ERANGE || isnan(d)) {
/* Return 1.0, as it's a small known value that won't cause a
- * divide by 0. */
+ divide by 0. */
return 1.0;
}
+ d = CLAMP(d, -FLT_MAX, FLT_MAX);
return (float)d;
}