]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_lenscorrection: fix division by zero
authorPaul B Mahol <onemda@gmail.com>
Sun, 13 Oct 2019 21:28:16 +0000 (23:28 +0200)
committerPaul B Mahol <onemda@gmail.com>
Sun, 13 Oct 2019 21:29:39 +0000 (23:29 +0200)
Fixes #8265

libavfilter/vf_lenscorrection.c

index b5400a2f37aca218b81a25e7257a9c97c04471a7..ac3c490821450718313d62c8f73c89cd6f5d7ccd 100644 (file)
@@ -155,10 +155,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     for (plane = 0; plane < rect->nb_planes; ++plane) {
         int hsub = plane == 1 || plane == 2 ? rect->hsub : 0;
         int vsub = plane == 1 || plane == 2 ? rect->vsub : 0;
-        int hdiv = 1 << hsub;
-        int vdiv = 1 << vsub;
-        int w = rect->width / hdiv;
-        int h = rect->height / vdiv;
+        int w = AV_CEIL_RSHIFT(rect->width, hsub);
+        int h = AV_CEIL_RSHIFT(rect->height, vsub);
         int xcenter = rect->cx * w;
         int ycenter = rect->cy * h;
         int k1 = rect->k1 * (1<<24);