[FFmpeg-cvslog] proresdec: Properly make sure an index doesn't run past the limit

Martin Storsjö git at videolan.org
Mon Sep 16 13:54:34 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Sep 12 12:10:18 2013 +0300| [ac9d159015a88aa2721b271875d18482f713f354] | committer: Martin Storsjö

proresdec: Properly make sure an index doesn't run past the limit

If idx equaled num_coeffs - 1 on entry to the loop, the previous
check failed to break out of the loop.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>

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

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

diff --git a/libavcodec/proresdec.c b/libavcodec/proresdec.c
index c13b769..c3b480f 100644
--- a/libavcodec/proresdec.c
+++ b/libavcodec/proresdec.c
@@ -496,7 +496,7 @@ static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs,
                 dst[idx++] = alpha_val >> 6;
             else
                 dst[idx++] = (alpha_val << 2) | (alpha_val >> 6);
-            if (idx == num_coeffs - 1)
+            if (idx >= num_coeffs - 1)
                 break;
         } while (get_bits1(gb));
         val = get_bits(gb, 4);



More information about the ffmpeg-cvslog mailing list