From patchwork Fri Feb 19 20:43:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 25817 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 776CF44A28C for ; Fri, 19 Feb 2021 22:50:22 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4F96E68A8F0; Fri, 19 Feb 2021 22:50:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-1.mx.upcmail.net (vie01a-dmta-pe06-1.mx.upcmail.net [84.116.36.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D220168A181 for ; Fri, 19 Feb 2021 22:50:15 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1lDCdp-0002N0-05 for ffmpeg-devel@ffmpeg.org; Fri, 19 Feb 2021 21:44:45 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id DCcrlsAVDljeHDCcrliwCX; Fri, 19 Feb 2021 21:43:45 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=BoHjPrf5 c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=YebzJ1pI9nT9uBEJRCYA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 19 Feb 2021 21:43:44 +0100 Message-Id: <20210219204345.14218-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfBeuwGcKLu3DhANTSbdvNA1eMgcyVtYKmfbGrTHtsGF8FvkdhsAfZc+uyvIOappOoZteET1i2R36vsP5HpG65YqIRp8vOz10lZqm1LPn2UTqG1hN6kXD oq8K2gkN3WFQnQbUCCAyeEut2lxs63V7jYVQl5xCBjVBkx46BK4S+8GP Subject: [FFmpeg-devel] [PATCH 1/2] avutil/common: Add FFINCREASE_PTR() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Suggested-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer --- doc/APIchanges | 3 +++ libavutil/common.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index c353d2d281..e38a5cb91c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2021-02-xx - xxxxxxxxxx - lavu 57.xx.100 - common.h + Add FFINCREASE_PTR() + 2021-02-14 - xxxxxxxxxx - lavd 58.12.100 - avdevice.h Deprecated avdevice_capabilities_create() and avdevice_capabilities_free(). diff --git a/libavutil/common.h b/libavutil/common.h index aee353d399..bf35bc8507 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -108,6 +108,8 @@ #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) +#define FFINCREASE_PTR(ptr, off) ((off) ? (ptr) + (off) : (ptr)) + /* misc math functions */ #ifdef HAVE_AV_CONFIG_H From patchwork Fri Feb 19 20:43:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 25815 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 0429F4479EF for ; Fri, 19 Feb 2021 22:44:53 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C1BF668A8BD; Fri, 19 Feb 2021 22:44:52 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-1.mx.upcmail.net (vie01a-dmta-pe03-1.mx.upcmail.net [62.179.121.160]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 575BD68A323 for ; Fri, 19 Feb 2021 22:44:46 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1lDCdq-00029A-0D for ffmpeg-devel@ffmpeg.org; Fri, 19 Feb 2021 21:44:46 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id DCcrlsAVdljeHDCcrliwCj; Fri, 19 Feb 2021 21:43:46 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=BoHjPrf5 c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=1XWaLZrsAAAA:8 a=ZoggBABO7sN_rTf-6lgA:9 a=pHzHmUro8NiASowvMSCR:22 a=xoEH_sTeL_Rfw54TyV31:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 19 Feb 2021 21:43:45 +0100 Message-Id: <20210219204345.14218-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210219204345.14218-1-michael@niedermayer.cc> References: <20210219204345.14218-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfOzXA/RDlctA48IC12bPXYATgIhSB81BUYrasV0u0YqZ50H+6sdkJlrub2d7FY21ZUKNhnRtJ5Gngh+HkMysZ7SwsCfTGVWB8YPNHkljApPvdm+IsabQ woxEPp815ulbXuB2wdcdHsqMM16fub/LValGQPBCrsX34pMpQqg9dSQw Subject: [FFmpeg-devel] [PATCH 2/2] avfilter/vf_scale: Fix adding 0 to NULL (which is UB) in scale_slice() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Found-by: Jeremy Leconte Signed-off-by: Michael Niedermayer --- libavfilter/vf_scale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 58eee96744..f1fbbf2978 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -635,8 +635,8 @@ static int scale_slice(AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, s int vsub= ((i+1)&2) ? scale->vsub : 0; in_stride[i] = cur_pic->linesize[i] * mul; out_stride[i] = out_buf->linesize[i] * mul; - in[i] = cur_pic->data[i] + ((y>>vsub)+field) * cur_pic->linesize[i]; - out[i] = out_buf->data[i] + field * out_buf->linesize[i]; + in[i] = FFINCREASE_PTR(cur_pic->data[i], ((y>>vsub)+field) * cur_pic->linesize[i]); + out[i] = FFINCREASE_PTR(out_buf->data[i], field * out_buf->linesize[i]); } if (scale->input_is_pal) in[1] = cur_pic->data[1];