avcodec/dnxhdenc: fix possible out of bound writes for big w/h

It was caused by integer overflows.
This commit is contained in:
Paul B Mahol 2022-03-04 23:25:48 +01:00
parent f497731260
commit 37480b1b85
2 changed files with 4 additions and 1 deletions

View File

@ -1228,6 +1228,9 @@ static int dnxhd_encode_fast(AVCodecContext *avctx, DNXHDEncContext *ctx)
ctx->mb_qscale[mb] = ctx->qscale + 1;
ctx->mb_bits[mb] = ctx->mb_rc[rc + ctx->m.mb_num].bits;
}
if (max_bits > ctx->frame_bits)
return AVERROR(EINVAL);
}
return 0;
}

View File

@ -34,7 +34,7 @@
#include "dnxhddata.h"
typedef struct RCCMPEntry {
uint16_t mb;
uint32_t mb;
int value;
} RCCMPEntry;