diff mbox

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

Message ID 20171009101448.14477-1-michael@niedermayer.cc
State Accepted
Commit c20f4fcb74da2d0432c7b54499bb98f48236b904
Headers show

Commit Message

Michael Niedermayer Oct. 9, 2017, 10:14 a.m. UTC
Fixes: test-201710.mp4

Found-by: 连一汉 <lianyihan@360.cn> and Zhibin Hu
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/ffv1dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Oct. 10, 2017, 9:41 p.m. UTC | #1
On Mon, Oct 09, 2017 at 12:14:48PM +0200, Michael Niedermayer wrote:
> Fixes: test-201710.mp4
> 
> Found-by: 连一汉 <lianyihan@360.cn> and Zhibin Hu
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/ffv1dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

[...]
diff mbox

Patch

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d2bfee784f..5eadb6b158 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -717,7 +717,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);