avcodec/dnxhddec: Move mb height check out of non hr branch
Fixes: out of array access Fixes: poc.dnxhd Found-by: Bingchang, Liu@VARAS of IIE Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 296debd213bd6dce7647cedd34eb64e5b94cdc92) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
7f3124e08c
commit
956f2db21f
@ -273,14 +273,18 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
|
|||||||
if (header_prefix == DNXHD_HEADER_HR2) {
|
if (header_prefix == DNXHD_HEADER_HR2) {
|
||||||
ctx->data_offset = 0x170 + (ctx->mb_height << 2);
|
ctx->data_offset = 0x170 + (ctx->mb_height << 2);
|
||||||
} else {
|
} else {
|
||||||
if (ctx->mb_height > 68 ||
|
if (ctx->mb_height > 68) {
|
||||||
(ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {
|
|
||||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||||
"mb height too big: %d\n", ctx->mb_height);
|
"mb height too big: %d\n", ctx->mb_height);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
ctx->data_offset = 0x280;
|
ctx->data_offset = 0x280;
|
||||||
}
|
}
|
||||||
|
if ((ctx->mb_height << frame->interlaced_frame) > (ctx->height + 15) >> 4) {
|
||||||
|
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||||
|
"mb height too big: %d\n", ctx->mb_height);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
if (buf_size < ctx->data_offset) {
|
if (buf_size < ctx->data_offset) {
|
||||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user