diff mbox series

[FFmpeg-devel] lavc/dvdsubenc: only check canvas size when it is actually set

Message ID 20231130102436.3979-1-anton@khirnov.net
State Accepted
Commit 5230257ea18e1d3761ee6b0549d56a3ca817f301
Headers show
Series [FFmpeg-devel] lavc/dvdsubenc: only check canvas size when it is actually set | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Nov. 30, 2023, 10:24 a.m. UTC
Fixes #10650
---
 libavcodec/dvdsubenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Nov. 30, 2023, 12:50 p.m. UTC | #1
Probably ok
diff mbox series

Patch

diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index d272b57675..06c2cf5e5a 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -376,7 +376,8 @@  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) {
+    if ((avctx->width  > 0 && x2 > avctx->width) ||
+        (avctx->height > 0 && 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);