diff options
Diffstat (limited to 'core/m_option.c')
-rw-r--r-- | core/m_option.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/m_option.c b/core/m_option.c index 883ecd70a0..507d6cc2c7 100644 --- a/core/m_option.c +++ b/core/m_option.c @@ -522,6 +522,10 @@ static int clamp_double(const m_option_t *opt, void *val) v = opt->min; r = M_OPT_OUT_OF_RANGE; } + if (!isfinite(v)) { + v = opt->min; + r = M_OPT_OUT_OF_RANGE; + } VAL(val) = v; return r; } @@ -562,6 +566,13 @@ static int parse_double(const m_option_t *opt, struct bstr name, return M_OPT_OUT_OF_RANGE; } + if (!isfinite(tmp_float)) { + mp_msg(MSGT_CFGPARSER, MSGL_ERR, + "The %.*s option must be a finite number: %.*s\n", + BSTR_P(name), BSTR_P(param)); + return M_OPT_OUT_OF_RANGE; + } + if (dst) VAL(dst) = tmp_float; return 1; @@ -1532,6 +1543,8 @@ static int parse_timestring(struct bstr str, double *time, char endchar) return 0; /* unsupported time format */ if (len < str.len && str.start[len] != endchar) return 0; /* invalid extra characters at the end */ + if (!isfinite(*time)) + return 0; return len; } |