[FFmpeg-cvslog] avcodec/cook: check that the subpacket sizes fit in block_align

Michael Niedermayer git at videolan.org
Sat Nov 1 13:35:34 CET 2014


ffmpeg | branch: release/2.4 | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 30 16:53:09 2014 +0100| [35bc67503e802289d69938953ec7a328dd0eab6a] | committer: Michael Niedermayer

avcodec/cook: check that the subpacket sizes fit in block_align

Fixes out of array read
Fixes: asan_heap-oob_fb5c50_19_018.rmvb
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 10e32618acce9c3fc64c061eb7907e8a8d2749ae)

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

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

 libavcodec/cook.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index eb2654e..0cc01d0 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -1215,8 +1215,8 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
 
         q->num_subpackets++;
         s++;
-        if (s > MAX_SUBPACKETS) {
-            avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS);
+        if (s > FFMIN(MAX_SUBPACKETS, avctx->block_align)) {
+            avpriv_request_sample(avctx, "subpackets > %d", FFMIN(MAX_SUBPACKETS, avctx->block_align));
             return AVERROR_PATCHWELCOME;
         }
     }



More information about the ffmpeg-cvslog mailing list