diff --git a/libavfilter/scale_eval.c b/libavfilter/scale_eval.c index 34365c0b3b..62e4e2de54 100644 --- a/libavfilter/scale_eval.c +++ b/libavfilter/scale_eval.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include "scale_eval.h" #include "libavutil/eval.h" @@ -186,6 +187,13 @@ int ff_scale_adjust_dimensions(AVFilterLink *inlink, if ((int32_t)w != w || (int32_t)h != h) return AVERROR(EINVAL); + if (w <= 0 || h <= 0) { + av_log(inlink->dst, AV_LOG_ERROR, + "Rescaled dimensions %"PRId64"x%"PRId64" are invalid, " + "output dimensions must be positive.\n", w, h); + return AVERROR(EINVAL); + } + *ret_w = w; *ret_h = h;