From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1FDDD42A23 for ; Wed, 11 May 2022 23:38:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D8ABC68B3A7; Thu, 12 May 2022 02:38:53 +0300 (EEST) 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 DC99068B289 for ; Thu, 12 May 2022 02:38:46 +0300 (EEST) Received: by mail-pl1-f178.google.com with SMTP id s14so3305617plk.8 for ; Wed, 11 May 2022 16:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=befbIOqu9HTbdxjcQixGv4Srfvvw4kYRrAJhW7qQxLY=; b=haWl/SjUaAGXRsuO+6R4vYnKA+2InxFW8fE7oimSHq5miCXOunQ284TxZQQDmCNQeg ryPMKmEGfHeIA3SeeG977t/gOF3lLwXOyL01FC57e27vCo1/nc+fZ77gGti+DDwhV1pb Bn9VqL/fRIbUYXZt5LvubyZB6ogohqN/DppRL0PaRQMe8mJNceTHCDPsOGPmasRoqwMI 3PxVCatGrQz4Ab1dvXT7Qpg+iig71rBhK/b/WYy4fFvjm5Dd56etmJ6z1L/mF2Q3+Km0 j5JWyKtUu3JPXddH/f9PrUeVT71itwPpLGxvJsHrwrUj/MOQ0RsXhwA7Z/OG76M+/o+y nwZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=befbIOqu9HTbdxjcQixGv4Srfvvw4kYRrAJhW7qQxLY=; b=jk5bev6nu2VEVMArVZfXxJkhj+JsrZIbQxTD0AZ5jzZcfLZhWCmy2Yq+09saX7pjtY YbKoFVgnoJF+Djda5Wf2WWdCkejmMXTGF83RkSrrVvm4zr3aBOMWLk+80QsMCxoVl0u/ KicWBLBfhjsnnw0jwmWPBNzKzC+QKVomM/PbyHz3+8AEyO4LZcFiIG1ndvn+KdTze+94 qx2SZuW8XKiOb/DLppmGx8JN61BrfMM5D8yQPA1eBiogJw5F1jxk0NsDYVTc6s/Vc50A TxyBz0N3nziey/a2NnsFMOgE6ZusS4x63htzNz2MzO0Bx3YtpaPD7yOO02VSM8EmD2Ag ut6Q== X-Gm-Message-State: AOAM531XjDbo4PxcHa4vjU7lEBWx9CMe1sfZIk2W/EK/odH+niDdzeum R6uPxIJO+WAn9SCyU3qjEZqxmVe1Vy8= X-Google-Smtp-Source: ABdhPJx+NjNhg8IZrTPJtmrr4/CCgKdvLo4Yla5CCRu8OfBONT73SnMhfAxoJzeM/x1Cy2fubXcohw== X-Received: by 2002:a17:90a:4d04:b0:1d9:3f18:f4dd with SMTP id c4-20020a17090a4d0400b001d93f18f4ddmr7744449pjg.111.1652312324605; Wed, 11 May 2022 16:38:44 -0700 (PDT) Received: from gmail.com ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id n25-20020a056a000d5900b0050dc7628158sm2318356pfv.50.2022.05.11.16.38.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 May 2022 16:38:44 -0700 (PDT) Date: Thu, 12 May 2022 07:38:40 +0800 From: lance.lmwang@gmail.com To: FFmpeg development discussions and patches Message-ID: <20220511233840.GA15884@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches References: <1652280498-10408-1-git-send-email-lance.lmwang@gmail.com> <1652280498-10408-2-git-send-email-lance.lmwang@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Subject: Re: [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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Wed, May 11, 2022 at 09:47:52PM +0200, Paul B Mahol wrote: > why? assuming the len is 1, the following code will access the next 3 array anymore, I think it's better to check the i with len -2. for (i = 0; i < len; i += 3) { to for (i = 0; i < len - 2; i += 3) { for the return, I think it's correct to return the used length, if it's error, have return already. right? -- Thanks, Limin Wang _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".