[FFmpeg-cvslog] avcodec/ffv1dec: Fix out of array read in slice counting

Michael Niedermayer git at videolan.org
Thu Oct 26 19:38:49 EEST 2017


ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Mon Oct  9 11:49:28 2017 +0200| [48933f28c2a8dce024bef8110e907811b3d4c9f6] | committer: Michael Niedermayer

avcodec/ffv1dec: Fix out of array read in slice counting

Fixes: test-201710.mp4

Found-by: 连一汉 <lianyihan at 360.cn> and Zhibin Hu
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c20f4fcb74da2d0432c7b54499bb98f48236b904)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 8a0a82e62b..aefa64e9b4 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -699,7 +699,7 @@ static int read_header(FFV1Context *f)
     } else {
         const uint8_t *p = c->bytestream_end;
         for (f->slice_count = 0;
-             f->slice_count < MAX_SLICES && 3 < p - c->bytestream_start;
+             f->slice_count < MAX_SLICES && 3 + 5*!!f->ec < p - c->bytestream_start;
              f->slice_count++) {
             int trailer = 3 + 5*!!f->ec;
             int size = AV_RB24(p-trailer);



More information about the ffmpeg-cvslog mailing list