Imported Debian version 2.5.0~trusty1.1
[deb_ffmpeg.git] / ffmpeg / libavcodec / tiff.c
index 4cb6668efb31ca7eeded5a123bbd3ce02ddad509..ee16d7805d76aa601043346940120894e8be2a13 100644 (file)
@@ -29,6 +29,7 @@
 #include <zlib.h>
 #endif
 #if CONFIG_LZMA
+#define LZMA_API_STATIC
 #include <lzma.h>
 #endif
 
@@ -510,7 +511,9 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
         }
         dst = s->yuv_line;
         stride = 0;
-        width = s->width * s->subsampling[1] + 2*(s->width / s->subsampling[0]);
+
+        width = (s->width - 1) / s->subsampling[0] + 1;
+        width = width * s->subsampling[0] * s->subsampling[1] + 2*width;
         av_assert0(width <= bytes_per_row);
         av_assert0(s->bpp == 24);
     }