summaryrefslogtreecommitdiff
path: root/libavcodec/proresdec2.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-11 20:51:30 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-11 20:52:01 +0100
commitc871244306f92fecaaed8a97f47ba54d46eb0cd5 (patch)
tree6aab73ce2f8687f453d688cb289c3e57d741b76e /libavcodec/proresdec2.c
parent7faa17764ad8aa9919125834b97e7fb574af90d4 (diff)
proresdec: check input size before reading qmats, prevent overreading.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/proresdec2.c')
-rw-r--r--libavcodec/proresdec2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index d14b535211..e643c87ade 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -133,6 +133,10 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
av_dlog(avctx, "flags %x\n", flags);
if (flags & 2) {
+ if(buf + data_size - ptr < 64) {
+ av_log(avctx, AV_LOG_ERROR, "Header truncated\n");
+ return -1;
+ }
permute(ctx->qmat_luma, ctx->prodsp.idct_permutation, ptr);
ptr += 64;
} else {
@@ -140,6 +144,10 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf,
}
if (flags & 1) {
+ if(buf + data_size - ptr < 64) {
+ av_log(avctx, AV_LOG_ERROR, "Header truncated\n");
+ return -1;
+ }
permute(ctx->qmat_chroma, ctx->prodsp.idct_permutation, ptr);
} else {
memset(ctx->qmat_chroma, 4, 64);