From patchwork Thu Nov 30 10:24:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 44848 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a301:b0:181:818d:5e7f with SMTP id x1csp243884pzk; Thu, 30 Nov 2023 02:24:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/jMTjpuV+pUxlU5lxcwZWiZInSs+rWZpMy2ickmBMpNO8QiUhoIC5UGId1d5/UNjxwqvR X-Received: by 2002:aa7:c608:0:b0:54a:f1db:c2b6 with SMTP id h8-20020aa7c608000000b0054af1dbc2b6mr17106159edq.20.1701339897869; Thu, 30 Nov 2023 02:24:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701339897; cv=none; d=google.com; s=arc-20160816; b=dJMspAT5nOOrlwxVlljTgQfiTdvN/6dmjiy++jlBDeBKcJhUU2FPzPjw08/mcLU+Un UAX7ZPNYPZlpM6FuN/J+rD8JQhIU/z1xo/EYbbW1VbEGWaDVvw/213Gv2bfIAJgc2P/t WFxf82pvUTpZcwg+IgcaiXQquRd1xxlyEON8gpCH7ha0fhOCeDe8UuxBZZSi/pjojrL7 2GwCCTL1AhBPPykdsNcVAMlaioeGCOYvqAB03fScdEL0rWJ3CiBzbRBCjSZoeL0iwXVn oVKZfiwisHz3dJ6do+S78+loSWPIHk4TIkAx3yXzl33eT4hJWNUR9er97i0JY2wcHvXK pgPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=FgkVl3efO6bBqnSemcdLisK5KJk6H/pZAQsW2yVt0YA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=Qk7dTcjYZmmzpaTpUr44wTVYum5+3aufDPI3sE7JOwJ8Fr+xQO7KFK4DeTynpYOezf ADyueP/k65U1pgJnlrgJ/W9Btn8CN4P2U2okRnwXWBLRUCOlUUCCVUoWn/KnCJqXa7td xD0bUR2P6IIHLL88lTK4P3eagvTX5oQfwrcXlL65Q/MpmbFRr11ZmHZpXlsnuEUmL6H7 w3tcX7k5d78ejFz3/GA/9wvc2BDCihe17yPCcVu4W25Nc+CRk3BxvXDhFCoYmEaJWox4 LD2cGLonkvj0YQWyaPax84AlyDCD4iCpIU7ubRX2CBYEOi5j8Rl8i7bDqrRrk4aVHZU5 c0Ow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l13-20020a056402124d00b0054b3b69e2fbsi422323edw.185.2023.11.30.02.24.56; Thu, 30 Nov 2023 02:24:57 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3D27E68D065; Thu, 30 Nov 2023 12:24:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0E39068D039 for ; Thu, 30 Nov 2023 12:24:46 +0200 (EET) Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 4DEE612F0 for ; Thu, 30 Nov 2023 11:24:45 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id nS0mU5umtpri for ; Thu, 30 Nov 2023 11:24:44 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id B18E71102 for ; Thu, 30 Nov 2023 11:24:44 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 550043A02E1 for ; Thu, 30 Nov 2023 11:24:37 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 30 Nov 2023 11:24:36 +0100 Message-ID: <20231130102436.3979-1-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/dvdsubenc: only check canvas size when it is actually set X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ZBDm8PhCJLcQ Fixes #10650 --- libavcodec/dvdsubenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);