Vitor <vitor1...@gmail.com> added the comment:

This bug has nothing to do with the cinepack decoder.

Patch attached.

----------
title: Cinepak decoder depends on unintialized memory -> Raw video encoder 
write random junk in the end of frames with odd dimensions

________________________________________________
FFmpeg issue tracker <iss...@roundup.ffmpeg.org>
<https://roundup.ffmpeg.org/issue956>
________________________________________________
Index: libavcodec/imgconvert.c
===================================================================
--- libavcodec/imgconvert.c	(revision 22109)
+++ libavcodec/imgconvert.c	(working copy)
@@ -724,8 +724,8 @@
 
     for (i=0; i<data_planes; i++) {
         if (i == 1) {
-            w = ((width >> desc->log2_chroma_w) * pf->depth + 7) / 8;
-            h = height >> desc->log2_chroma_h;
+            w = (((width + (1 << desc->log2_chroma_w) - 1) >> desc->log2_chroma_w) * pf->depth + 7) / 8;
+            h = (height + (1 << desc->log2_chroma_h) - 1) >> desc->log2_chroma_h;
             if (pix_fmt == PIX_FMT_NV12 || pix_fmt == PIX_FMT_NV21)
                 w <<= 1;
         } else if (i == 3) {

Reply via email to