From patchwork Wed May 11 14:48:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 35731 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp3933929pzb; Wed, 11 May 2022 07:49:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD4nh5EiWQ3xPQwT/Hamzpt60ArObEY20mx2huj8CYOojlrS9E6j9Nko3BzmVecEyGrnGf X-Received: by 2002:a17:907:3f95:b0:6f4:f45a:9f66 with SMTP id hr21-20020a1709073f9500b006f4f45a9f66mr24430335ejc.544.1652280567955; Wed, 11 May 2022 07:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652280567; cv=none; d=google.com; s=arc-20160816; b=j5/FD4XqGizGMlT6bLREk+mQAS/2A4DbMzMfY7SK304CPkoXjnsGibo6aoUYQoUHgs W5Qz7Ph4aR0oItH+iC0oFy8uXEHrfehGkIsLgdRDMzg2riPVkbpKhCfRBlpEAwe9SUh4 xzg/Wgt5DgUUKktf6vLESXet4zQwTYc73z7ryrKaC20bzebQ5aLaNT+V6MnKsjOKwU9S +AapWrGhN9GNBRBEHEqKZO0pxMuL2ATabm6h77Qxa+871QXOiZVeGubfZ6HR5h5kITbm chIptULK1fi7V2bXSpkujr9aAadDWTeTvUkDKMkJbOuQ6SNkPfYZ7h/iPzWT3+tPLvu2 HBQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=e9AT1A6jGocHhxUaKMVrJvrO2B8eh1YrQ4jimkU7MC4=; b=EMGIzpYa4Z4M7EqX9ViHW1VDla327E7hCflUXyQf0cS+q1/KRxc5bV2qlBq601f6p1 C3UXN+w3QInR0Jl9raKSimm8Hq9JCWzgM/v1twcisE2MkYy/ckjbzWO8r/0rJYkd9tVN csh9TQPRtoF8THDpu7jBgZMgm4f4CIgdxin4/nra57cMWYfdHgt911nASsK3Q214DQuz zgFwgjWtneEtekmEB6Ll8q5iBd86TegLNNVrcBrzi/YT2FdNJ2uQegzsMZVgZX3qVWSY d1A5rb25SW4lJHf53eRb4//cokAftn0UClVR/321TxG93AgRtASxFDQRDEJHz4gcaelk qDPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=HevJay3H; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hs36-20020a1709073ea400b006f4abbac711si3033735ejc.136.2022.05.11.07.49.05; Wed, 11 May 2022 07:49:27 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=HevJay3H; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 676EC68B39E; Wed, 11 May 2022 17:48:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4C70B68A631 for ; Wed, 11 May 2022 17:48:26 +0300 (EEST) Received: by mail-pj1-f53.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso2326876pjg.0 for ; Wed, 11 May 2022 07:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=Qs6AqcVyZxdlAtFGhvgJz5zqy9tZRHzbuH0mHgcs1ME=; b=HevJay3H7u9oPSdznDJo4l6cthTGA+VlphRqljAb0ECKMiJcGg75SdF+hGSzGs9gGX rSibvrhdY6DAKDWPpkgGEQeayGWgac5+FtSZ8VGO0FGRpMwhThqbVWozPsCzJRnTbfAF Ear4BHihpdndncZXn2BsaTtOHKCvt2p3HJE36ebgnS+d/Z14lFSSXhgeVPwXrIjj+wSI 0NS+4KcmfQqqS0M2m1Q2zlcWjYQ2tkDZTmA1TVwpqioYTP2cruEs9SukXkUaFMGgGtgy jWyhBfd1OOVirVFtBv3ufa3RPhsYadn33FM8MeDb7+PIvrUrtP2COPq5Xa2F5jxK+HUU Mw2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Qs6AqcVyZxdlAtFGhvgJz5zqy9tZRHzbuH0mHgcs1ME=; b=c1nq5FjXY5AsCH1fQvZht1ypAMCZIIaTtuiNwQbcGuNhGso4UNb85dPfUu2y+9/cK/ O1shZqJeV6M7x28xmgszRtemfbFweS9GyqJbyE2NLxdtO49Qce/IbWsFbUX/eUE6fHlI /VdUdZiOEqUS0lgmHiNEumQKR/83uJOMdOMFwM+TKOxz551vOiJ3f//2RSsF2iSVUcTC hi6Uh5zwWaWE67uG7CNnB1d5Ep8Zw2ZjAJBSODvSxVeZYVxptCDlxf80l1mEyBdoJuBN DEyDiBpirsZqDTHKhSpzZTIK0ROYjjJQtYbvCHrhFxA8tWj1GguBhLqSLeTsI7EHynzP pizQ== X-Gm-Message-State: AOAM532dUveNrhVmNvCvgqw1buQmF/ftktrNuqKHPItij/aScP74vmOw coIfVkJo8TXex/hTY+4Q2/A8Pdz4H04= X-Received: by 2002:a17:902:864b:b0:15e:f9e0:20ca with SMTP id y11-20020a170902864b00b0015ef9e020camr19756597plt.122.1652280504138; Wed, 11 May 2022 07:48:24 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id n17-20020a170903111100b0015e8d4eb2c6sm2059020plh.272.2022.05.11.07.48.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 May 2022 07:48:23 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 May 2022 22:48:15 +0800 Message-Id: <1652280498-10408-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 1/4] remove sccenc dependency on subtitles 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HfxJX8QkArkL From: Limin Wang Signed-off-by: Limin Wang --- libavformat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 3b9995a9d3..8e612b6cc7 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -514,7 +514,7 @@ OBJS-$(CONFIG_SBC_DEMUXER) += sbcdec.o rawdec.o OBJS-$(CONFIG_SBC_MUXER) += rawenc.o OBJS-$(CONFIG_SBG_DEMUXER) += sbgdec.o OBJS-$(CONFIG_SCC_DEMUXER) += sccdec.o subtitles.o -OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o +OBJS-$(CONFIG_SCC_MUXER) += sccenc.o OBJS-$(CONFIG_SCD_DEMUXER) += scd.o OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o OBJS-$(CONFIG_SDR2_DEMUXER) += sdr2.o From patchwork Wed May 11 14:48:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 35730 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp3933898pzb; Wed, 11 May 2022 07:49:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNsj7tCs2NLDoR4xE20acgAA7SzprG1FZuH5Q1Ke4Ash0ol55rjAJIcIvlnOZthQ+rqDse X-Received: by 2002:a17:907:d06:b0:6f4:13cc:80c2 with SMTP id gn6-20020a1709070d0600b006f413cc80c2mr24932580ejc.500.1652280564031; Wed, 11 May 2022 07:49:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652280564; cv=none; d=google.com; s=arc-20160816; b=bh4xWk5NDcD94+DW7vbXH05qgSCIVziRJFjgfql26fH+cSR+NG3cnKo9/DKvpmuwDc zr5MtzA1m/j64b4Md/P8okxUTInlIfD7JUBHptpK9WNtJr10KEWUUkY9/i0KoglLjzS+ mR/r9QYX+58/opja4dvNdAvoptEccnHYGtmFn4bDonvNZ/Q1G2w3Vtif7zEpFwCj/yP+ eDxmiEPalcTpYJfxpeDgEMKCxGz8cDLJp1iifezq2aPOl45iZYfxRysQqEK1I/dJyZwj t7N9dEoK6BPacae7V2pzwZoVzhb4CyzOACTnP8vuq857e0/Sl8v0rjVB9cdWlhYQE54c EdBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=YjovFS5/swJpBImcHXXnYUA2PHFDmvRIhdDDJy/UHcg=; b=Q5Zz1iiiBnrpvVeQGGt6f7JqQamwdVfv46ypu9rZzqpZC/Z1iw3K96Zqj7PuFSAFFQ C5W5zU4BLk4Uh15G4RPth3przfQq4TmKxBll23My1kjo3bWaE0Ndbah3U/OWZYZcIrMg FxelZMA25RdHmY0Esk3TuYBZHuAKrPODTUg7m0UjGuawySFe9aj0Yfr5eCBlJb1RVZbh dsy8uVPqTrjn/EJypnRSMFrYfwezo+VbWqtNTLG5RKHdSytEawNIv0KQCf+JA4V4BQTp uG7c4RgnZS5YFw1ici2/M3Mj1qsYhmxX/L8KxoO9i3qqw1gqto1hE9msRIgGEN5qlE1f L8Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=bYj2vemH; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gs12-20020a1709072d0c00b006e8bf488698si2939872ejc.202.2022.05.11.07.49.00; Wed, 11 May 2022 07:49:24 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=bYj2vemH; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 79E6268B410; Wed, 11 May 2022 17:48:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26CCC68B3EF for ; Wed, 11 May 2022 17:48:27 +0300 (EEST) Received: by mail-pl1-f178.google.com with SMTP id q18so2078365pln.12 for ; Wed, 11 May 2022 07:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NNP0pD+EpFcAgUWgJfYcpv1RRKTidb9y4kLV11fNo8Y=; b=bYj2vemHVygdgypJdYzSx2TcyhNXeoDuac9/X+bJJA+skFUcZ9aSLeXJiK8+6dwktg G4l0ST0dWtJWlgEs6k7yoCRgpKhBKdTx6jqlFBqNkD1Z/utAFgL/EDV06WR1E2Y2Hz/A woLIhodQxadDVGRbmK0ADchFKCftl/9zSAHMDED2dkQ//SKpEmMrVo1gE93UmT7luM3v Ae7GwYZV4EJ2rf9Bg6NCgd+pX/4opi8Tw6hVGGE12Sy8CxjWqoTf3lm00rQ984O5opBd eLfTqqecky1iIdFRGOzKOZoxjiJDJ8Zhe7hV52ZnAurfg/4qOZrOVhNM3zu7FXjrMOBx XiRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NNP0pD+EpFcAgUWgJfYcpv1RRKTidb9y4kLV11fNo8Y=; b=qTpUxanr6fYO8/i5CVbxH4GqOivPgzj6AYPe4jPisnnXVk1lWds9fUrEfZHbpKFZNx qVvkRqhW6WuO57wUx9SDKKXGYs7I0qhSt4dbxrDD6IydPYWHOplDjgYAPSW9CbFupq+S VN1eHzWZ0/U9QshUEDJrgRLTLTMKd+VnGuCIIc1VjMIVwJOu66eL/BGiim1UuDweQxLJ ptM/XbRy7rcc87u1FGm/gepItKGa/IR/SZcz1bn45tEOCacPnIwYUs+FJAdcDLKekW3g 2jnIT0qVuNA5vn44AauAUx+VPuSOehzqAywAUyr78l0XVT2MWWRhOfl18XBpjqeI0zUx CNsA== X-Gm-Message-State: AOAM532AMaroZEhlNn5PoPrCF3elekGmCEwfBmRBbSh4iuEUBmkjg6uB CxrsB/0R0RBhLaVrGjMAFJeBKPEUtN8= X-Received: by 2002:a17:902:ab59:b0:15c:f4f3:7e3b with SMTP id ij25-20020a170902ab5900b0015cf4f37e3bmr26365540plb.24.1652280505360; Wed, 11 May 2022 07:48:25 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id n17-20020a170903111100b0015e8d4eb2c6sm2059020plh.272.2022.05.11.07.48.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 May 2022 07:48:25 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 May 2022 22:48:16 +0800 Message-Id: <1652280498-10408-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1652280498-10408-1-git-send-email-lance.lmwang@gmail.com> References: <1652280498-10408-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/ccaption_dec: check the length of packet and return used length 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: nTWN04iTgc7m From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/ccaption_dec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c index 34f0513b1a..8f61e8aa03 100644 --- a/libavcodec/ccaption_dec.c +++ b/libavcodec/ccaption_dec.c @@ -852,6 +852,11 @@ static int decode(AVCodecContext *avctx, AVSubtitle *sub, int i; unsigned nb_rect_allocated = 0; + if (len < 3) { + ff_dlog(avctx, "incomplete or broken packet"); + return len; + } + for (i = 0; i < len; i += 3) { uint8_t hi, cc_type = bptr[i] & 1; @@ -922,7 +927,7 @@ static int decode(AVCodecContext *avctx, AVSubtitle *sub, } *got_sub = sub->num_rects > 0; - return ret; + return len; } #define OFFSET(x) offsetof(CCaptionSubContext, x) From patchwork Wed May 11 14:48:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 35732 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp3934080pzb; Wed, 11 May 2022 07:49:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxo+MLOhQGN+qg35SDv8NUWxdJKEmlMlcShoythYkvic0kWUjdui1zsW7qdLu5uYBVQ8tQr X-Received: by 2002:a17:906:dc93:b0:6f4:6a93:f227 with SMTP id cs19-20020a170906dc9300b006f46a93f227mr25015040ejc.661.1652280581804; Wed, 11 May 2022 07:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652280581; cv=none; d=google.com; s=arc-20160816; b=uwsiaKdaQkzXSRVii5NyyVVWIbV+oWsEU9t2mzAhL8gpPZxxlGCbzmMGVUK4zrDdoA n5+aCuE3kQ5rLLMCD/VzV4frt0Z8BWbL9ob8NNQ1HKunyRnbZ1jWfeinslMUosvWTg5g hgoOpyuDuOqeU82WNhYPnSH9y/CQwCZVjvylXVtdmbv5ND9Stv8iCcjdpQsXWRtaPMR5 EReyU0N3vWiEswg5u6N84CF6Oua220erJMfCXfVC5ojLYnAdhWideLpbuC/ctpCZapLJ 40apdFKMM55W6eeplGiWz80VAy2WmTQcAN6MXz4rIv+VWdQBNIYxgx5lnkAlg0QJJOF9 0iRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=CElQbFmg4knx+X2+uIyzLtmLumsEeauOjq6bsbeGabc=; b=sPMycwOr2Z4kSKJE3J3tSxT1/XyjhfP6TGXxNSyMkkT82Kz7IrzqRHNj9m2h9lX3xa Kx6h6kzcbgfGVbqnHob/Kl4vZJ0lh15aAEipgECDMTvb1ULnexu0fF6qg5M+IMHQTZVu nLAiM5/3lkGrx9OwuJse+P0J9OLpNA+sxqpWHrULrtvK6JqMFrbh3rsRg5FMCx1SC43C AzdRSaMq1292SHwfnoYaUlf2U2MQl+1+enrVkDDPi6oJKmJwenvUIfNooMt6B5KxM4P3 cAI5vn9+YPWGaTR7DqpVCoCwyV+MHLr7hZMlPtrIREqq/QCnHqwRcXY9eKq3w//li5xf iQbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=OH36ihhT; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dn15-20020a17090794cf00b006f4664eeba5si2846867ejc.390.2022.05.11.07.49.15; Wed, 11 May 2022 07:49:41 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=OH36ihhT; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 840B468B445; Wed, 11 May 2022 17:48:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E70B68B411 for ; Wed, 11 May 2022 17:48:28 +0300 (EEST) Received: by mail-pj1-f52.google.com with SMTP id x88so2470977pjj.1 for ; Wed, 11 May 2022 07:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2Cmj3OGzpcM5MapK/L2PH2LdlSyxaLEZQzf4UF9XhwU=; b=OH36ihhTqHJZS+6mxjfsfl2cYj8LFELVVrIuEMrXTV7/v/+LVBC5xW9WRWEnizwPxP S3fZXIx+CU7PiID38uS4YOPs7pf8SLv1alzXfnD4quJWBqie1whz7ZnJX8OGSIRGo8hl X51JGEehkWuawgFjGBkyWjAE1nHfTxHXnWCxanvEr7xcKobCy4CAQSdkGoIwwCkbhsy3 NnHxu1jbUEf3J8MCYcW8RJYgqxSYEqtNZPZlC8IYG/eTYGk4I/wXW6VuQIYp4zavQODj anv5Jj3XNfU8PkpWzNECWtV4IlhSxMFfBMMXE2qyibLHwSNWxB0W2fYs4XpAayvwwd13 sX6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2Cmj3OGzpcM5MapK/L2PH2LdlSyxaLEZQzf4UF9XhwU=; b=lB0X1dkD9QaPVDmEnF1JRRi3Ebx1dL+JbPjGMdZq5pgJKReBn+xBrmisKVra3GD1EG mARcDyGvgYBm5YMoi2vPnHFJQDgqBzqnYBXIkA2db1ul56B8IaCbFZUsh2De8d4vY7Og QTBK8q4iiwtLrilV55G1icQbGA1GF+3DTDQaPD+NzRNO/CA63vEkyk3oChA9btTBmLNs gUUNu2Q4/sLIlSI5wm8d9SV3M4vreHc87SXsEyHRCAft13Yv8NValyUdVJaJGAqnX3bJ /XYeNN21BIQBSboLpJXIfVdprAVpybp/lsR1Vsc45wBkpUpZ+TmrZeXX+/6veVFPSwBc O6Nw== X-Gm-Message-State: AOAM532WSaCP4Zocc6KbBFoZy1eMg07by6Wa26c3CPt/oIhILymew3bt LcA/AWuTz1dZq0xz7HmCp5S3fz67l9U= X-Received: by 2002:a17:902:b213:b0:158:d44d:cad4 with SMTP id t19-20020a170902b21300b00158d44dcad4mr25764649plr.45.1652280506641; Wed, 11 May 2022 07:48:26 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id n17-20020a170903111100b0015e8d4eb2c6sm2059020plh.272.2022.05.11.07.48.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 May 2022 07:48:26 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 May 2022 22:48:17 +0800 Message-Id: <1652280498-10408-3-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1652280498-10408-1-git-send-email-lance.lmwang@gmail.com> References: <1652280498-10408-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 3/4] avformat/sccenc: avoid potential invalid access 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: DVXrJAIDwNTH From: Limin Wang Signed-off-by: Limin Wang --- libavformat/sccenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/sccenc.c b/libavformat/sccenc.c index c8c4d097e4..2b924ba6e7 100644 --- a/libavformat/sccenc.c +++ b/libavformat/sccenc.c @@ -72,11 +72,11 @@ static int scc_write_packet(AVFormatContext *avf, AVPacket *pkt) s = (int)(pts / 1000) % 60; f = (int)(pts % 1000) / 33; - for (i = 0; i < pkt->size; i+=3) { + for (i = 0; i < pkt->size - 2; i+=3) { if (pkt->data[i] == 0xfc && ((pkt->data[i + 1] != 0x80 || pkt->data[i + 2] != 0x80))) break; } - if (i >= pkt->size) + if (i >= pkt->size - 2) return 0; if (!scc->inside && (scc->prev_h != h || scc->prev_m != m || scc->prev_s != s || scc->prev_f != f)) { From patchwork Wed May 11 14:48:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 35733 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp3934100pzb; Wed, 11 May 2022 07:49:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFFGFQw+tTo81nITzYmvgV3qLdR+pdSpPBsFMdvRVf8MNqPkghHsmna4Csx+K1geTF5nDP X-Received: by 2002:a17:907:7282:b0:6fa:9365:f922 with SMTP id dt2-20020a170907728200b006fa9365f922mr10810077ejc.262.1652280583943; Wed, 11 May 2022 07:49:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652280583; cv=none; d=google.com; s=arc-20160816; b=0pPe8LpaWit1AxjL9m4QotNygXzzBAFN4lG1pAJlDlaXSnfqjDunjDYuxz189Fuq0d CP6fMxWeAL4TACu1A4eljhBRImbeOOtla8GWdIX6q8OpujpXB4KOa+U972hGjIeYnIZR ReLvIXDIaHzYsq6veEMPMoKgmqnuRzfmpzU+eS2cCUZ+Uw72krnl0MqA1HGwCvMf66Pb 4b3M4jWXlJt4deQ7G5A327DT5TJ5bNK23v08wZCQzguZ1OlJdKWX1Pzj9aEhmLFFuJF5 A61MtwdJmeTf5jdm78WBeDKhNBJy/jCxk9FSizuoxtH7Rtbj9xUpAi3FP/btdmCftCyp cFhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=Zo9eCBFk9/+pLUCG9+tAryXqBALDoRFISeDNcQ6E6F0=; b=SbGmxB0U1OcBkbxI9v/HlwRNAW7wvUW8AmYwcg1r7flVnocGWIFN9pRnJitEsTOsrR 2w+DElEyFAFp/+ECzJL00jl/HAtADJB9W1V+V1jdhO2VD95T8JSoXJU7qNFWFCE0wPWl dI8BrOUa/fHWWDGPim+jQUZCkHs0mFBZuWB+jQ4RGqNw6YoI2uPgNQQiaYj2j3idrMT/ vu/3w83NP3quw1jZcUmARC2v4ZVLw4S+5cxOWAExZKhxNQB0rw75xyP1bAdG2qmGtkVS yhubqrVUJ/KNoG3jUEcfupGYdtLa3781/YI75vIu8wN5C4l44oaw5aOw9eGhCSs6gfVl XvOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="ED+/lhk+"; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t17-20020a056402525100b00421b5d86019si213747edd.45.2022.05.11.07.49.22; Wed, 11 May 2022 07:49:43 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="ED+/lhk+"; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 83AE668B2F9; Wed, 11 May 2022 17:48:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E4E668B443 for ; Wed, 11 May 2022 17:48:29 +0300 (EEST) Received: by mail-pj1-f47.google.com with SMTP id n10so2436668pjh.5 for ; Wed, 11 May 2022 07:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WBk+kqWjekKqi3COi7ggFtY/nxu0hDoWDiSLXyCtwJ0=; b=ED+/lhk+zWciQArakMdRkaggYsvJj3xhOXsWTPj2+NJOsVjTNLBwWiEPIr5acSe9ag c61o/2gK/n1ra2jo+3wor9AOewNlz2tSTunsKg0I24XLy6ykBqM3nrB1HDzpBKQO/OMq pBdRd+HOdrwzsRZwL5ixgLi22246ODMgiCX+j9mT72mLBy0V0aPzDtkWDLXwcagfzTtV oEb5VYZR78t+wx/KXx/JR4GqEv5mfsfoctwXRoK8xtSA2z+S90XYy6oR26WTiBFrF8On rlU9QBsTNqqrpvZs2XDfJWfD8AE8x0f3fOo1Mnfvbi4jed1P2gElmnEmR9Dws6wgbHnv DCrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WBk+kqWjekKqi3COi7ggFtY/nxu0hDoWDiSLXyCtwJ0=; b=uO3dfxTbeowhwK/Bm2xI3pFrqp4YKVy8UZiBiVXbtjYAAFvfGS/38hG/Nb9nOylYoJ +AYVOm7uwlJ76r7fgaqVNxBFK3vIIF8AjsrD9CFfK7LMtmRngVgS9RsBUyo5LQkbrRky ZAp6Z6U3BWqfFZEKOYeuD98tucWPVgpeF5iEQ1s0r6rKxKySw2NoDNy5zPgifNuRjAdt eyYh9K77H6x6GQmVCjhltsecJi1U+3pHKlz1pdLdwmsbkpcqJqF4lQ5TN3AbfNr63ZnP +W+F3ywgu2HUeRl4PBnnhlwRVSB05KK1lrf8zsFIRVlDEHIyWleyFotJQS+M5flUhsq2 tqeQ== X-Gm-Message-State: AOAM531CUolcrj02caSoUKnf/JPistbciblR74RcSo3UVnPmLLeQMwHr kM6vaJZDiEu4UqJCNpHwFi8Ybr0yHsk= X-Received: by 2002:a17:902:8c98:b0:15f:3e78:dc43 with SMTP id t24-20020a1709028c9800b0015f3e78dc43mr266117plo.120.1652280507833; Wed, 11 May 2022 07:48:27 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id n17-20020a170903111100b0015e8d4eb2c6sm2059020plh.272.2022.05.11.07.48.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 May 2022 07:48:27 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 May 2022 22:48:18 +0800 Message-Id: <1652280498-10408-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1652280498-10408-1-git-send-email-lance.lmwang@gmail.com> References: <1652280498-10408-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 4/4] avcodec/dvdsubenc: return error if canvas_size is too small for subtitle render 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Uku00cZh/Eq9 From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/dvdsubenc.c | 6 ++++++ 1 file changed, 6 insertions(+) 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;