summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
Diffstat (limited to 'fitz')
-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 dd9f8ea2..2c8877c8 100644
--- a/fitz/base_string.c
+++ b/fitz/base_string.c
@@ -256,10 +256,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;
}