From patchwork Sat Aug 14 15:07:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 29511 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp522736iov; Sat, 14 Aug 2021 08:14:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8DjiMcK8pznmrHvuXMWDdVrEG3F8a8UMO9gvXpzSw5MZhoi4PYcThG7ozlUEn3VF19Wgk X-Received: by 2002:a17:906:6884:: with SMTP id n4mr7802307ejr.265.1628954073604; Sat, 14 Aug 2021 08:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628954073; cv=none; d=google.com; s=arc-20160816; b=OBxB5F5RAO4DtH0jl8rj8DvlPvAY4jQrAnStfVDRN5aDFWmu1jUVkHu5qFP1oaRF6W 3cCz7rBy6xvB9a0us/ehdVYUwag4BxOnzNKo2kVnXjieHWyzQNQ2+Hp+VCxiAh4EMLd9 C5MobsqRbp/FNR7xju/5QwcJdLnTk3XesvKTU+KcJFDCtStDuBSEwZHwNXUfGypLtPXR +OnRA8J9nAUZDexWEDjTbLzO1p16BweLWJ02pb0mkiK3Ty9nla+HULXZxNguM71aaVDE UaJ/FDnvXmvBs9pH4pzpSVd4Fsn600e4+0EK3Vl2CvaU14VTHHjAIPlajb+Dqwqi4twx kDzQ== 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:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to; bh=BktDt4ag06a96jAO5EG8dPX4FDMyRONQJjtetW65YD0=; b=et6jMgvfkkF6qWPYxxMMJvm/sJao9tNSU6oWoIW4jMuKoicQ+PjornmvS5kTUjhcUy BESVVtoEJEGKgHdR446p/101DQk+IWOHclCUBXv6iFiAZCUNU5y2ELgj8xOoaydzy64m NnUV0YCdyPqlYAS6DdWJrydq21o7dDvJyzBZnluCd/l41JNQPIOOOnb/DE8uF6TdOZHS fp0EHZdMN9J5qSgEPXXDl2Y6tLtZ9HXRhEoAoTFYSv/Xee7n5mxfeh2XoL1t6x2LoYu/ Uib9q/DlWVYb1mXX5Jw2PUCaZAYWM0boge8+KhANpQN25R37KPDIdqY+dJs6kC1kaPYt vRHw== 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 s8si5241765edx.49.2021.08.14.08.14.33; Sat, 14 Aug 2021 08:14:33 -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; 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 55DD768A6A3; Sat, 14 Aug 2021 18:14:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-3.mx.upcmail.net (vie01a-dmta-pe05-3.mx.upcmail.net [84.116.36.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 45A4068A67D for ; Sat, 14 Aug 2021 18:14:23 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1mEvHR-00G9Pi-0o for ffmpeg-devel@ffmpeg.org; Sat, 14 Aug 2021 17:09:01 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id EvGTm9IxpljeHEvGTmywiI; Sat, 14 Aug 2021 17:08:01 +0200 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=nZOtpAppAAAA:20 a=t_SXrZAmivG6hszDsa0A:9 a=1fhp2MxaeJtTNGEnv6mo:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 14 Aug 2021 17:07:59 +0200 Message-Id: <20210814150800.13974-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfPQBugdqrVk+hfEbRNV+ud15P4ksetv1O87d4URdg1lMi3Q5LVCsu+lpUxs1rGp/vuJRj0P8M2DyKlxD0MaziK8BNbZdxaN47MCR6cg8EiVF1P9TfrvU 1WbqwdEWDG9k2kUfViIEeuuGdCXduua5um7ZWF2QatKs8F4dWyDtEaDR Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/snowdec: Cleanup avmv on errors 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: OxVkbQvyjDHS Fixes: Assertion failure Fixes: 36359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-6733238591684608 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/snowdec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c index 1355ae6ed1..7ef28c4899 100644 --- a/libavcodec/snowdec.c +++ b/libavcodec/snowdec.c @@ -499,7 +499,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, s->avmv_index = 0; if ((res = decode_blocks(s)) < 0) - return res; + goto fail; for(plane_index=0; plane_index < s->nb_planes; plane_index++){ Plane *p= &s->plane[plane_index]; @@ -618,11 +618,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVFrameSideData *sd; sd = av_frame_new_side_data(picture, AV_FRAME_DATA_MOTION_VECTORS, s->avmv_index * sizeof(AVMotionVector)); - if (!sd) - return AVERROR(ENOMEM); - memcpy(sd->data, s->avmv, s->avmv_index * sizeof(AVMotionVector)); + if (sd) + memcpy(sd->data, s->avmv, s->avmv_index * sizeof(AVMotionVector)); } +fail: av_freep(&s->avmv); if (res < 0) From patchwork Sat Aug 14 15:08:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 29510 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp522597iov; Sat, 14 Aug 2021 08:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzON7B8Z8xSq8cSPq9WIbQQw5EY11AFT5SK7RdivCV4NZ7pyDljXlHWii0SiXjb8rUTK3AO X-Received: by 2002:a05:6402:5192:: with SMTP id q18mr9488697edd.149.1628954060655; Sat, 14 Aug 2021 08:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628954060; cv=none; d=google.com; s=arc-20160816; b=c1Z5rGnkZ8ZCFvBvzQ6MDfJR4PeBgEg+BAQqpbBMQW5MVH+hfJedSicrxL5tPhvqor kDYD8Jtvbsk1XBk9sbyHsMzviHS3Oqj7cUxJkN5lrNiDqeXL6Y/LEC5ee3fy5T15LGwN DuEPNPy6sTFL+piXIWJq4zP8kyJnwNFNnwEKLwLqFNi2V6Gn5k47Ek/b5cJvu3LFW8Wi typhGYdc0IIlSNgmA50f110OA0kgdPKIBE5ppd7PB9nggV4d1ECT4UFbU1kqfGxhmGlr R2t+RF+e2dhh30F54NuMValbd10bo584ZxXv75QZvNw4fwRsnhvNyc29hJHqQPAeRS1l g+Jg== 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: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:delivered-to; bh=uavAB/KEv42l++c2NcWcWKOM25W8Cwj58LOsp8ao5aY=; b=JfqE6I63iJ7dY5ILjIoqJMJdY3h/Be6p2cYLQQFb2TT1/u6dwnydBoGAE2H7IqMMU8 /Z86AYft9cIiHs0kspZvX9bpAF6l2ICsFMV6caEjCO+gerkY5TW0vKB3OTFPUHksBUnG qoVYW2tgkS0ccoyS5UcDlIL+9xIxNTrZlpP6LH9rk7lojLxTuCNs9qDfsOfkN63ueMo4 9cJz+N9kkUZtU7gNLf1iXHb9OUkWG5xs0FuRHKkH0lpgIKNUfYemes5uOAKPrqJ+x17M 7YfcU/q43dqrUMJlIyYZZV84pPkA3XaV6AZQsrIhyRYQZyiKCtbqfTXKmAUPwtME/2F8 w8YQ== 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 ne8si5772231ejc.243.2021.08.14.08.14.19; Sat, 14 Aug 2021 08:14:20 -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; 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 3FC5168A63F; Sat, 14 Aug 2021 18:14:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-3.mx.upcmail.net (vie01a-dmta-pe05-3.mx.upcmail.net [84.116.36.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 80A166899E0 for ; Sat, 14 Aug 2021 18:14:09 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1mEvHR-00G9TK-0o for ffmpeg-devel@ffmpeg.org; Sat, 14 Aug 2021 17:09:01 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id EvGTm9Iz5ljeHEvGTmywjK; Sat, 14 Aug 2021 17:08:01 +0200 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=nZOtpAppAAAA:20 a=wdkXCKs3Vz8aPe84FHoA:9 a=1fhp2MxaeJtTNGEnv6mo:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 14 Aug 2021 17:08:00 +0200 Message-Id: <20210814150800.13974-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210814150800.13974-1-michael@niedermayer.cc> References: <20210814150800.13974-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfPQBugdqrVk+hfEbRNV+ud15P4ksetv1O87d4URdg1lMi3Q5LVCsu+lpUxs1rGp/vuJRj0P8M2DyKlxD0MaziK8BNbZdxaN47MCR6cg8EiVF1P9TfrvU 1WbqwdEWDG9k2kUfViIEeuuGdCXduua5um7ZWF2QatKs8F4dWyDtEaDR Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/h264_parser: fix nalsize parser 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: zF5+E5igU+YH Fixes: left shift of 16711968 by 8 places cannot be represented in type 'int' Fixes: 36601/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6581933285965824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/h264_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index d3c56cc188..22111c62a2 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -86,7 +86,7 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, int nalsize = 0; i = next_avc; for (j = 0; j < p->nal_length_size; j++) - nalsize = (nalsize << 8) | buf[i++]; + nalsize = ((unsigned)nalsize << 8) | buf[i++]; if (nalsize <= 0 || nalsize > buf_size - i) { av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %d remaining %d\n", nalsize, buf_size - i); return buf_size;