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 747C342EC4 for ; Thu, 12 May 2022 15:17:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7E8DB68B456; Thu, 12 May 2022 18:17:25 +0300 (EEST) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6470F68B3F4 for ; Thu, 12 May 2022 18:17:19 +0300 (EEST) Received: by mail-pf1-f177.google.com with SMTP id p12so5117821pfn.0 for ; Thu, 12 May 2022 08:17:19 -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=aFk59/i9h3cvRk3CqzJOS2YeAM/LAuK2OwL8HxXQV+w=; b=VKkhPAQUfeSUSjmlH3PE2AYyg8biqP2fRUSosNX+sUQRzyyy45tAWb+zV8sXbOhFY6 E/hSVGREk6nPRYdrfgX8eHLyMKoHWHC19flAvdEnIoCEUc1CrZWX3RMCX266wSev881f QiYktP7kLzMvm52HH5ho+O6Aw34kvTordyZEbnYqRO2khY+XnQ3o6nNbm35rAi4Ap2VQ 8tRJGStclo02UHlUNgK933Bm63TiSoyUPtpP/Evo9X1/RMY4PMpB24+ttlxu8C7NuQMt 7ruyWkMEPTzoSl8dbimGxjt9CGGj1yg/gwGW/wBjaRmZKjB/w+uz+rd8h41OCDxnHX8i GCkg== 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=aFk59/i9h3cvRk3CqzJOS2YeAM/LAuK2OwL8HxXQV+w=; b=d2c6+CxipiMSaHj4EaFGG2X6luCVUck7CrqJp3i47Q9oq8CluCmXyGcoUA+tHVFaRH 6RMN+khnBm5Ye2JeC9MsmvtE/n9drz819ljMTSqJ1D+iLPzFaIUwTXpEtbAPOs/WYibm fgRIBcHMBfWp7MD+GmHwuts55Ufa2osHv2y/eGJ3z5f0VM6LghIAKsXPDesDB0iJGmXa djnC+mM2jLcCkCs+Utx386fCmz1QBpg/Zc5x1DsKdeD8dOYDo+7D5vQOahpSOrOkIz8I w1IWvxWUuz//ejuQJUxwA2ZCJ0k7RHYnFda1oWKPY2El57/VvCk2uVYar2EWpqRbe4NL 6mig== X-Gm-Message-State: AOAM532p8PJyp7MoWuq06gJ2bTk67YcHOGCqTWHOBnnW2NHZ1ARV1o5K HbA6L9ZZrWT2fvaQ8EOYoiAKcT53FmA= X-Google-Smtp-Source: ABdhPJxDSUlTxyqtYrvvLVTU58lnsiiRxD+r9x7Uwo8GNAx5nK+ye02vpxnsY2FeNXruw3kQCZ+gXQ== X-Received: by 2002:a65:6e88:0:b0:39d:2647:f75d with SMTP id bm8-20020a656e88000000b0039d2647f75dmr126916pgb.523.1652368636777; Thu, 12 May 2022 08:17:16 -0700 (PDT) Received: from gmail.com ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id l20-20020a056a00141400b0050dc76281a1sm3978996pfu.123.2022.05.12.08.17.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2022 08:17:16 -0700 (PDT) Date: Thu, 12 May 2022 23:17:13 +0800 From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Message-ID: <20220512151713.GA8500@gmail.com> Mail-Followup-To: ffmpeg-devel@ffmpeg.org References: <1652280498-10408-1-git-send-email-lance.lmwang@gmail.com> <1652280498-10408-2-git-send-email-lance.lmwang@gmail.com> <20220511233840.GA15884@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 Thu, May 12, 2022 at 08:25:29AM +0200, Paul B Mahol wrote: > On Thu, May 12, 2022 at 1:39 AM wrote: > > > 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? > > > I doubt so. maybe I'm misunderstand it, but from the comments, the API claims that: libavcodec/codec_internal.h 175 * @return amount of bytes read from the packet on success, 176 * negative error code on failure 177 */ 178 int (*decode)(struct AVCodecContext *avctx, struct AVFrame *frame, 179 int *got_frame_ptr, struct AVPacket *avpkt); 180 /** 181 * Decode subtitle data to an AVSubtitle. 182 * cb is in this state if cb_type is FF_CODEC_CB_TYPE_DECODE_SUB. 183 * 184 * Apart from that this is like the decode callback. 185 */ 186 int (*decode_sub)(struct AVCodecContext *avctx, struct AVSubtitle *sub, 187 int *got_frame_ptr, const struct AVPacket *avpkt); > > > > > > -- > > 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". > > > _______________________________________________ > 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". -- 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".