[FFmpeg-cvslog] dpx: Fix rounding in 10bit total_size calculation

Michael Niedermayer git at videolan.org
Sun Feb 10 18:10:08 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Feb 10 17:50:56 2013 +0100| [151067bbc2200e3130eb9e4bab242dfd8db78761] | committer: Michael Niedermayer

dpx: Fix rounding in 10bit total_size calculation

This could have caused out of array reads

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=151067bbc2200e3130eb9e4bab242dfd8db78761
---

 libavcodec/dpx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index 92c0e4b..0237b44 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -159,7 +159,7 @@ static int decode_frame(AVCodecContext *avctx,
                 return -1;
             }
             avctx->pix_fmt = AV_PIX_FMT_GBRP10;
-            total_size = (4 * avctx->width * avctx->height * elements) / 3;
+            total_size = (avctx->width * avctx->height * elements + 2) / 3 * 4;
             break;
         case 12:
             if (!packing) {



More information about the ffmpeg-cvslog mailing list