aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-11-30 23:42:04 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-12-02 00:28:59 +0100
commit44dc83f0e07a7bcce135ced249d231c3a7b2fd5d (patch)
tree2d2e6bd009c4069f113996926b2012750e47cb0a
parenta65633aa9d2291244d039abeda2864492ca810c6 (diff)
downloadffmpeg-44dc83f0e07a7bcce135ced249d231c3a7b2fd5d.tar.gz
avcodec/j2kenc: Fix out of array access in encode_cblk()
Fixes: 4427/clusterfuzz-testcase-minimized-5106919271301120 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 0674087004538599797688785f6ac82358abc23b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/j2kenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index c8d3861732..baaf47422c 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -688,7 +688,8 @@ static void encode_cblk(Jpeg2000EncoderContext *s, Jpeg2000T1Context *t1, Jpeg20
cblk->npasses = passno;
cblk->ninclpasses = passno;
- cblk->passes[passno-1].rate = ff_mqc_flush_to(&t1->mqc, cblk->passes[passno-1].flushed, &cblk->passes[passno-1].flushed_len);
+ if (passno)
+ cblk->passes[passno-1].rate = ff_mqc_flush_to(&t1->mqc, cblk->passes[passno-1].flushed, &cblk->passes[passno-1].flushed_len);
}
/* tier-2 routines: */