avcodec/dvbsubenc: Sanity check num_rects
It is written as region_id which is a single byte. Also fixes a potential (defined) overflow in the num_rects * 6 multiplication later; this has been found by 김승호 <kimsho98@naver.com>. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
bad3f308d3
commit
3acc3b0b50
1 changed files with 3 additions and 0 deletions
|
|
@ -284,6 +284,9 @@ static int dvbsub_encode(AVCodecContext *avctx, uint8_t *outbuf, int buf_size,
|
|||
if (h->num_rects && !h->rects)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (h->num_rects >= 256)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (avctx->width > 0 && avctx->height > 0) {
|
||||
if (buf_size < 11)
|
||||
return AVERROR_BUFFER_TOO_SMALL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue