[FFmpeg-cvslog] avcodec/cavs: prevent out of array read

Michael Niedermayer git at videolan.org
Fri May 16 03:19:29 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri May 16 03:02:57 2014 +0200| [1fb46858c2498c67ae2d6775f7da29732e88fb8a] | committer: Michael Niedermayer

avcodec/cavs: prevent out of array read

The used value should not matter as long as its within the array
as it is multiplied by 0

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

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

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

diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index c5313eb..888f38b 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -525,7 +525,7 @@ void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type)
 static inline void scale_mv(AVSContext *h, int *d_x, int *d_y,
                             cavs_vector *src, int distp)
 {
-    int den = h->scale_den[src->ref];
+    int den = h->scale_den[FFMAX(src->ref, 0)];
 
     *d_x = (src->x * distp * den + 256 + (src->x >> 31)) >> 9;
     *d_y = (src->y * distp * den + 256 + (src->y >> 31)) >> 9;



More information about the ffmpeg-cvslog mailing list