diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2022-05-08 22:52:14 +0800 |
---|---|---|
committer | Limin Wang <lance.lmwang@gmail.com> | 2022-05-19 21:17:31 +0800 |
commit | 94968dbc1116e23cb658c09538e9bce52b63d654 (patch) | |
tree | 9595d40e4b496d6892e709214f3fc1dc7a784fda | |
parent | 8e828ee1add997ff3d1ca5539773a15df6b9f05e (diff) | |
download | ffmpeg-94968dbc1116e23cb658c09538e9bce52b63d654.tar.gz |
avcodec/dvdsubenc: return error if canvas_size is too small for subtitle render
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
-rw-r--r-- | libavcodec/dvdsubenc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index fc3b7d1816..d29db7d49c 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -376,6 +376,12 @@ static int encode_dvd_subtitles(AVCodecContext *avctx, x2 = vrect.x + vrect.w - 1; y2 = vrect.y + vrect.h - 1; + if (x2 > avctx->width || y2 > avctx->height) { + av_log(avctx, AV_LOG_ERROR, "canvas_size(%d:%d) is too small(%d:%d) for render\n", + avctx->width, avctx->height, x2, y2); + ret = AVERROR(EINVAL);; + goto fail; + } *q++ = 0x05; // x1 x2 -> 6 nibbles *q++ = vrect.x >> 4; |