vf_showinfo: check return code of av_image_get_linesize()
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 27 Oct 2012 22:40:28 +0000 (00:40 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 27 Oct 2012 22:40:28 +0000 (00:40 +0200)
Fixes CID703716
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/vf_showinfo.c

index 297e8f1..07b42db 100644 (file)
@@ -52,10 +52,13 @@ static int end_frame(AVFilterLink *inlink)
     int i, plane, vsub = desc->log2_chroma_h;
 
     for (plane = 0; picref->data[plane] && plane < 4; plane++) {
-        size_t linesize = av_image_get_linesize(picref->format, picref->video->w, plane);
+        int64_t linesize = av_image_get_linesize(picref->format, picref->video->w, plane);
         uint8_t *data = picref->data[plane];
         int h = plane == 1 || plane == 2 ? inlink->h >> vsub : inlink->h;
 
+        if (linesize < 0)
+            return linesize;
+
         for (i = 0; i < h; i++) {
             plane_checksum[plane] = av_adler32_update(plane_checksum[plane], data, linesize);
             checksum = av_adler32_update(checksum, data, linesize);