From patchwork Thu Dec 23 21:15:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 32872 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp7621017iog; Thu, 23 Dec 2021 13:17:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIciJxNXTMZBwJy56OtemGcxX3pqMb8S3+ofpforJ3ySujV7hwdFCNlBd3enuShSTVzmR2 X-Received: by 2002:aa7:c641:: with SMTP id z1mr3527467edr.84.1640294220020; Thu, 23 Dec 2021 13:17:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640294220; cv=none; d=google.com; s=arc-20160816; b=cZ6MjKooZV5GtUJWR29cL1J251Z+ACVzuWstNLeIF5I8U1AAH/ELrkbTPEV4hQhT35 WbWotABjLnf/RIbIH8eXRhZbOlKVEEiCCpStNxRO3ggPwyQalWJUlslfCFh7Ne3Aolct T6zcqsPigaoTj3V4XV9UrtEy8OnGGrtwmPvgkRuIqlQZoZ9oabv8SbEMRhlUoUeiRF+3 zsT3cm4xSF1kZDzKjzPlDeE4dJ8VS/g4qgBq1omHpsZZjPgmxEvfBxOuOxEeb6DUbsby ys+hIiVENUhCUD2XnhuENEMKLTkQ5+tPuqsWy8jOoDRP3Mkym3831l8StcCUDImltY/j 0D9Q== 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=6nmASPaNK1V4oC6bnrVu70dO/bXizmfokwYY0D+M83w=; b=Ekr2ziFWhnZyOaeVKf8S8W7sL9N+QLQ7tUebTxw7g0fQ3WJF6QcJQMwY0OSge/TBLF Sxe2grxTMChwZEayMSJ8trv0vwCYawN7JoJpEQGXcbjkQ5FP5cU8j1w2tptV9mHcQpPV 0iyCElCMQoM98ZfzybdSTIvoFexxA2GVpWLP5pIA3FcWXJK2qI6ZpW6vcd5h85/dJcIg 8zsye/NbhHH2Q1E6LMoBmvp8bqyUkmWgodjPpYEUu9puE9/g17E/amAuUebEYa3p3qge aNIZ9wtBsZxcsMtJGRsO8oWyh1Eohcadf5W1J2Ul8YiuiD7hjHpFbR1/72GXl/DvAl8G TvXQ== 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 h20si2546958ejj.282.2021.12.23.13.16.59; Thu, 23 Dec 2021 13:17:00 -0800 (PST) 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 6CCB368B1CE; Thu, 23 Dec 2021 23:16:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-1.mx.upcmail.net (vie01a-dmta-pe04-1.mx.upcmail.net [62.179.121.163]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D7B468B1AF for ; Thu, 23 Dec 2021 23:16:28 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1n0VRs-00G7AM-0F for ffmpeg-devel@ffmpeg.org; Thu, 23 Dec 2021 22:16:28 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id 0VQtnM8JWSgGF0VQtnabXG; Thu, 23 Dec 2021 22:15:27 +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=f8Q2+96M 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=NEAV23lmAAAA:8 a=IGcOdrckTnUG_8ieB9sA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 23 Dec 2021 22:15:23 +0100 Message-Id: <20211223211527.20408-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfJcCTGtosQs0tcnrCF6utPh4b7FPGgQcBTTtlULIlnhbS2gmYLQdWZYQInFu+WDmgh5n4rl9VA0ffK1CvYlGu2+ayU9KSj0MgxWsGvDhjbPy77z3VKgc esBOUieu13Ozs/rN7/r3DF+TIEfB7FFZazgeK7wy20iLl22q29G4xW9u Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/targa: Check input size for uncompressed TGA before allocation 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: 1NVhIPBGhEQt Fixes: Timeout Fixes: 42667/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TARGA_fuzzer-5619236075077632 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/targa.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavcodec/targa.c b/libavcodec/targa.c index 221fcc956d0..b0048621d35 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -117,6 +117,7 @@ static int decode_frame(AVCodecContext *avctx, int idlen, pal, compr, y, w, h, bpp, flags, ret; int first_clr, colors, csize; int interleave; + size_t img_size; bytestream2_init(&s->gb, avpkt->data, avpkt->size); @@ -180,6 +181,15 @@ static int decode_frame(AVCodecContext *avctx, return avpkt->size; } + if (!(compr & TGA_RLE)) { + img_size = w * ((bpp + 1) >> 3); + if (bytestream2_get_bytes_left(&s->gb) < img_size * h) { + av_log(avctx, AV_LOG_ERROR, + "Not enough data available for image\n"); + return AVERROR_INVALIDDATA; + } + } + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->pict_type = AV_PICTURE_TYPE_I; @@ -251,7 +261,6 @@ static int decode_frame(AVCodecContext *avctx, if (res < 0) return res; } else { - size_t img_size = w * ((bpp + 1) >> 3); uint8_t *line; if (bytestream2_get_bytes_left(&s->gb) < img_size * h) { av_log(avctx, AV_LOG_ERROR, From patchwork Thu Dec 23 21:15:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 32873 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp7621142iog; Thu, 23 Dec 2021 13:17:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfFinSbskTdSHxSZj587dWBsenxyUG9t6ZEPk2AxauiMq2w0HAmqBdPKyb73QUh9fh1XKT X-Received: by 2002:a05:6402:3496:: with SMTP id v22mr3448889edc.263.1640294232024; Thu, 23 Dec 2021 13:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640294232; cv=none; d=google.com; s=arc-20160816; b=reL760igiAmk1JpLK3M+ew40W+Ry/LnHXGjE1jGiTa3jfw53ztOpjKdk4J8NtNvefd 29TIjtFbiTEflRRZ+v80ekL+J5jYMBaGyLQQ6SwIv0SgGiADytcvB9X1g1pNMs7GP88X nBXIHqtYPJ+BbVrW9SgO6WauPl+2FgKF2VkMZwpULygkpnLP1pn1YFlFP1ebbEwUmFZM mGA5mHGsjLUyRyhaioh2Jj0O/WT9i+LdZYm1x+hKEWafnK9zRPuMtIeXlBrtfbFVCAbw nvfEhqzloXi0Re4CkgNdX3PuZdmSRwVIfbyfDoqCewZ4IlMZ5VUoWqjvVfVurXiJem1C xfJg== 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=5kehwEt0p0Ld//oncFNj0iI7a1p8jCRDV/74fMD9rzg=; b=Rb103WzSrD/t1NqKMx7VQO/qXshTv1Qj5x43t3EzppAeN+qbM7Edzn4pJ0xI035Dd8 9vrjPVvMDRUFpdYzPYhpatay4eM7rnAuAnB+PnH0DmZj7MAmIlDgpeleIItUkq3NK+Xc pHcqkzVXnjsyOxa9sRiFrgINaRsgtMwLrMAAJnFSXD2wWmHInlAuE5+/aWhblOCAmpGM RVeLCsGa4gG0RbC5WB+5ddJi+El+JMsPOrOfhYM5E8L2jeo2akJy35hOu7dviV0EoXWv EAvat5y6c9WMx0dq71VwI6s6Uja9QIvJJq28CNsSLJa2ktcKc4ImNm/Y04HLGeXyXNb+ oAbg== 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 g13si2406405ejo.123.2021.12.23.13.17.11; Thu, 23 Dec 2021 13:17:12 -0800 (PST) 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 31F3068B1D4; Thu, 23 Dec 2021 23:16:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-2.mx.upcmail.net (vie01a-dmta-pe03-2.mx.upcmail.net [62.179.121.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D0BB68B1AE for ; Thu, 23 Dec 2021 23:16:28 +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 1n0VRs-005l9p-0F for ffmpeg-devel@ffmpeg.org; Thu, 23 Dec 2021 22:16:28 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id 0VQunM8LaSgGF0VQunabY8; Thu, 23 Dec 2021 22:15:28 +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=f8Q2+96M 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=NEAV23lmAAAA:8 a=EXflR0fOmIkgLJZ6d4sA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 23 Dec 2021 22:15:24 +0100 Message-Id: <20211223211527.20408-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211223211527.20408-1-michael@niedermayer.cc> References: <20211223211527.20408-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfJcCTGtosQs0tcnrCF6utPh4b7FPGgQcBTTtlULIlnhbS2gmYLQdWZYQInFu+WDmgh5n4rl9VA0ffK1CvYlGu2+ayU9KSj0MgxWsGvDhjbPy77z3VKgc esBOUieu13Ozs/rN7/r3DF+TIEfB7FFZazgeK7wy20iLl22q29G4xW9u Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/cdgraphics: avoid signed overflow in alpha 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: fHY9/zzW+rvz Fixes: left shift of 255 by 24 places cannot be represented in type 'int' Fixes: 42766/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CDGRAPHICS_fuzzer-5142826105569280 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/cdgraphics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index 06f83920943..f54ce5a05c0 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -122,7 +122,7 @@ static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low) r = ((color >> 8) & 0x000F) * 17; g = ((color >> 4) & 0x000F) * 17; b = ((color ) & 0x000F) * 17; - palette[i + array_offset] = cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b; + palette[i + array_offset] = (unsigned)cc->alpha[i + array_offset] << 24 | r << 16 | g << 8 | b; } cc->frame->palette_has_changed = 1; } From patchwork Thu Dec 23 21:15:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 32871 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp7620924iog; Thu, 23 Dec 2021 13:16:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxytpBiGvOhZvIwjTOyEmg4UxuyI6qQhmh30GMcoBnO3oV93xXu+lN8VnJ5SIk4o9ad5doi X-Received: by 2002:aa7:d8c5:: with SMTP id k5mr3501837eds.247.1640294209889; Thu, 23 Dec 2021 13:16:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640294209; cv=none; d=google.com; s=arc-20160816; b=MSY0KUECCWZQmFLGX/zvXXYb+KIBN8TuZWHyV3RMa+MCIsSb5zbJGDj7+W6PAkiLlq 6409+L7H6Qd6BSSg3ApKEaj6zNK5mUqHg2ygnTqRByvLE+UK4EFu8DN6rQkg6cOzO/5w eT8RMT2JSWDEodu7ynK97almQS5QZUh/x9QJwN0s9gBmpF6pIzCN8G9a29C1JDSHDvHt myk+L44TfxTeHHfWwG8StpF3vJsNMXSs4wRMiLACRahbydJKOBpttonL8Z0nIm73g5/F uv/uDVK2FLsb4PdTx9iOIv9zCBGHuKhLaRVn29mg5lVDYzTt5/7ho1J4x8BclyHc+4Ej CeNw== 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=qVN+nRWiL+Y4dcco5lUdeMY7Pa2BWietzRSon1cK1+4=; b=LEFBa3GFYdLxspsoRYonURXmOjnM34Zv/nD7sLXxyXQZZsPIrSZghjhkiVByRX/VRN yCuUy7jNSQR4v81fm7ER6/FGZMuzFD7FvPFo7mghcM/dzX/7yZBfq5eR5yQLqR0Mtols jqZHeb44rHBtVYLHYJ+zrsEbvnbQzO54xr/x8t/9NFuaWBWXiQGvpaAo19PbyvTxs624 bFhdDa2bNIzoqaqtvCIydvmKUGVUZclMcIEHAkw5bjVRpH0vDMjcw5E1rLt56SNzhmis 6HQNKm/9kqVLiw+31pjs5Ru2Fvh3ZvclpS1DqhRKzS0nkaIrX6CfVCeHLXfMNXKTTZ58 UcaA== 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 z20si2725534edc.487.2021.12.23.13.16.49; Thu, 23 Dec 2021 13:16:49 -0800 (PST) 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 7239D68B10B; Thu, 23 Dec 2021 23:16:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe04-1.mx.upcmail.net (vie01a-dmta-pe04-1.mx.upcmail.net [62.179.121.163]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8B38C68B192 for ; Thu, 23 Dec 2021 23:16:28 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1n0VRs-00G7AT-0F for ffmpeg-devel@ffmpeg.org; Thu, 23 Dec 2021 22:16:28 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id 0VQunM8MMSgGF0VQunabYM; Thu, 23 Dec 2021 22:15:28 +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=f8Q2+96M 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=NEAV23lmAAAA:8 a=GNbjFuMf3N3Jl0flRs4A:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 23 Dec 2021 22:15:25 +0100 Message-Id: <20211223211527.20408-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211223211527.20408-1-michael@niedermayer.cc> References: <20211223211527.20408-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfJcCTGtosQs0tcnrCF6utPh4b7FPGgQcBTTtlULIlnhbS2gmYLQdWZYQInFu+WDmgh5n4rl9VA0ffK1CvYlGu2+ayU9KSj0MgxWsGvDhjbPy77z3VKgc esBOUieu13Ozs/rN7/r3DF+TIEfB7FFZazgeK7wy20iLl22q29G4xW9u Subject: [FFmpeg-devel] [PATCH 3/5] avformat/flvdec: timestamps cannot use the full int64 range 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: SsePxYm+Ai2O We do not support this as we multiply by 1000 Fixes: signed integer overflow: -45318575073853696 * 1000 cannot be represented in type 'long' Fixes: 42804/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-4630325425209344 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/flvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 44a7e5f93cc..b9e36b3ff1b 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -461,6 +461,8 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, int64_t m d = av_int2double(avio_rb64(ioc)); if (isnan(d) || d < INT64_MIN || d > INT64_MAX) goto invalid; + if (current_array == × && (d <= INT64_MIN / 1000 || d >= INT64_MAX / 1000)) + goto invalid; current_array[0][i] = d; } if (times && filepositions) { From patchwork Thu Dec 23 21:15:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 32874 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp7621260iog; Thu, 23 Dec 2021 13:17:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcy5V9Il0iFXA9EMuJaqvmPsdTuOt5/J/kJUXGXHyKf/XMoBMjf6I2X4N6Dz7hQZw5o9nN X-Received: by 2002:a17:907:86aa:: with SMTP id qa42mr3261269ejc.106.1640294242627; Thu, 23 Dec 2021 13:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640294242; cv=none; d=google.com; s=arc-20160816; b=RRdyO/JyI0b/PSpXyrSfWdh+BVF+sLXPmzeWLxBxrorhZPYlChQfo1tA9KIrqaISs6 p9MaAgkeucFpDbhSwH3Jo5ksOViM3lFNrxoGmuughce0qt5Mm1UJtdbaHwmwRPZwvbHf s1wx8TeWk6DLok2KYiHefxmgI1q1q7HJ+weT8zCBKq6S178Y18WnUPFnANM/uaO+LD0n s2eN1gX4O78B681V+ggecSTsN3RVf+R8mzahh4S2qV5pfQTTgI3tM8u7xg5VU9zx1+bf 8J+pAz2bgMH4ITY6bD3mIG0JuAeMjJqk63v8DKbPflVvfM0EqO3Hh048lAEK8hTbJn2M iFTA== 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=Rra3mr2Q1tHBZOXS+6aQf1rJkKm+/8wNWqsqwkWU72c=; b=vpETB4WtSJ+Nq/JL9yZ2WRdB8Ly0OHvOeKyc13fOpinvgTLbuC+TVCaHzTXcHY3hej sBtVwnE1PgzAJHujqfgEKH8AMFnk/pVBIUwWxhKsa0pnjWdQIv9HkbBOJ4/SYeQz8AfT jdlr/m5s8WtYoYN3Q3p4XvUsMQKnJ3vyOUH9bshHAYzKK4Kq3XlNTl1EtZalTc30XKa8 sSepVDYzKzI1MvdZvvWNWxv1skhkLCXrRvhxNJIMBZsDfuyXc+fuMVCpWLoZwP7gKN0U iwpZBotm03t4lLrhrP5QSsSJbQ24prh7MUHVfOfX9Id8PKziNmePt2uQO+sxADX03QRo RBhQ== 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 u11si1256064ejt.38.2021.12.23.13.17.22; Thu, 23 Dec 2021 13:17:22 -0800 (PST) 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 F3A6968B1D9; Thu, 23 Dec 2021 23:16:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-2.mx.upcmail.net (vie01a-dmta-pe05-2.mx.upcmail.net [84.116.36.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A0A6C68B1B2 for ; Thu, 23 Dec 2021 23:16:28 +0200 (EET) 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 1n0VRs-006Nz2-0E for ffmpeg-devel@ffmpeg.org; Thu, 23 Dec 2021 22:16:28 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id 0VQunM8N3SgGF0VQunabYe; Thu, 23 Dec 2021 22:15:28 +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=f8Q2+96M 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=NEAV23lmAAAA:8 a=aqyFfHkSW8-hnrmUHNkA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 23 Dec 2021 22:15:26 +0100 Message-Id: <20211223211527.20408-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211223211527.20408-1-michael@niedermayer.cc> References: <20211223211527.20408-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfJcCTGtosQs0tcnrCF6utPh4b7FPGgQcBTTtlULIlnhbS2gmYLQdWZYQInFu+WDmgh5n4rl9VA0ffK1CvYlGu2+ayU9KSj0MgxWsGvDhjbPy77z3VKgc esBOUieu13Ozs/rN7/r3DF+TIEfB7FFZazgeK7wy20iLl22q29G4xW9u Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/apedec: fix integer overflow in 8bit samples 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: cf0rTldlinwO Fixes: signed integer overflow: 2147483542 + 128 cannot be represented in type 'int' Fixes: 42812/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-6344057861832704 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/apedec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 35a2e617e69..b932263012e 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -1587,7 +1587,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, for (ch = 0; ch < s->channels; ch++) { sample8 = (uint8_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) - *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff; + *sample8++ = (s->decoded[ch][i] + 0x80U) & 0xff; } break; case 16: From patchwork Thu Dec 23 21:15:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 32870 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp7620832iog; Thu, 23 Dec 2021 13:16:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCo5FcCZGddx66zrrhPGRLlUiNcmc+6coU1erN6s1ayEVSLjgjqUwp4BX8Y2Js9k485PZy X-Received: by 2002:a50:ed01:: with SMTP id j1mr3468362eds.126.1640294201042; Thu, 23 Dec 2021 13:16:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1640294201; cv=none; d=google.com; s=arc-20160816; b=gdc0bKcR64PFK6fYbcQ3sHHkEg5NCFQLKuHv57z6lY7ZITcqch6iWAZvVDLDl9NSW2 cg3KL7I2LEl6qMpyTHU3qi+M0gWjAjtsuuIVKw4j5C3ge2wmLXatwuvE7T9ql1h4xUxg eVNiiCcrslI6oSd+K1Bbo6Byx1SRl55iKEHMwyKg3gAZ36jDRGcBR52eYBc2rwjFS54K IcZZaoLf20IFtNx7j6D7DIdOAeWLoKNdgTMvYT9QcoLRyXkIby0/jmhEPavmDg8x5eax 7s+qnEiF0vEXwUK0H3vl3JvVoxu9RaVqz75+4VUIemEn3hp19GWkfdlkPVMBpZtekJxW +G5w== 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=bi9K5JVVWfRnvFietbUSCLWG9u+Q6oJcvlkwh7wzkqk=; b=jx9aho6n4iSqIDDuSihnmvj/QdUlSRoNUGHJS0OMuLwlN4jSWD1YYd2HORIeoS61Da StcfeFA7N7JjSSbsiuYRYTij08s3paruFlKiwml2kcJLrZ2FUN4xd+DLJ4xg/vlPALSn 53RDjjEpN+baCzE7P37QHhEbvq8VrF9glIaKCr4UH5+ERO50ogCwFHENFWUX7iYXIuLU 5h1AMf4CYrke13ACVo+NtgHH/FD+eBK4H7AcK1dB+i5tXBoEOJKvz5y7c0JNAZS5bR6I q94d87WpDg+9F7lzVG8cO0p6PfmQ2IOsZwO1xIRaHwUjBk8tWKin1ThXs4EBHfkQTN/S hnlg== 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 h3si3451205ede.422.2021.12.23.13.16.39; Thu, 23 Dec 2021 13:16:41 -0800 (PST) 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 74CA968B1AF; Thu, 23 Dec 2021 23:16:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-2.mx.upcmail.net (vie01a-dmta-pe02-2.mx.upcmail.net [62.179.121.158]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 89A5B68AEE5 for ; Thu, 23 Dec 2021 23:16:28 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1n0VRs-00AuDX-0F for ffmpeg-devel@ffmpeg.org; Thu, 23 Dec 2021 22:16:28 +0100 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id 0VQunM8NUSgGF0VQunabYu; Thu, 23 Dec 2021 22:15:28 +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=f8Q2+96M 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=NEAV23lmAAAA:8 a=JMo6NDeKBe8AcFON-J4A:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 23 Dec 2021 22:15:27 +0100 Message-Id: <20211223211527.20408-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211223211527.20408-1-michael@niedermayer.cc> References: <20211223211527.20408-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfJcCTGtosQs0tcnrCF6utPh4b7FPGgQcBTTtlULIlnhbS2gmYLQdWZYQInFu+WDmgh5n4rl9VA0ffK1CvYlGu2+ayU9KSj0MgxWsGvDhjbPy77z3VKgc esBOUieu13Ozs/rN7/r3DF+TIEfB7FFZazgeK7wy20iLl22q29G4xW9u Subject: [FFmpeg-devel] [PATCH 5/5] avformat/mvdec: Check bytes_per_sample 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: j7KWyHiTQ8Gf Fixes: division by zero Fixes: 42814/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-4787014237552640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/mvdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c index 1a5012e5076..390f6ba4de8 100644 --- a/libavformat/mvdec.c +++ b/libavformat/mvdec.c @@ -366,6 +366,9 @@ static int mv_read_header(AVFormatContext *avctx) avpriv_request_sample(avctx, "Audio compression (format %i)", v); } + if (bytes_per_sample <= 0) + return AVERROR_INVALIDDATA; + if (set_channels(avctx, ast, avio_rb32(pb)) < 0) return AVERROR_INVALIDDATA;