From patchwork Tue Jul 12 18:43:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 36763 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:6da0:b0:8b:e47:9dbf with SMTP id wl32csp2206318pzb; Tue, 12 Jul 2022 11:43:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vRAgw9df9i9aKiWZIjPnk+O/qLgyBJ7JiKOj/yldJ+/meWmnqwE/W1sQcesHTteDI6ygft X-Received: by 2002:aa7:c683:0:b0:43a:13fe:9c69 with SMTP id n3-20020aa7c683000000b0043a13fe9c69mr33911779edq.353.1657651431577; Tue, 12 Jul 2022 11:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657651431; cv=none; d=google.com; s=arc-20160816; b=K2JlEdyT8C4ww1w8SQQwD5WExMbaKsDq1GlJ7J1ON4haZVyecLt7KLFv5q+CMPdyRO MEeXpuKV7+pD6c5QcNLetJ4ciEfwcc4iQW6UlLasvYRwPxwqsLqgkC38vxhsuayiFStX TF5aIzDDIz2halazO9L7TlLz0brJ+jZH2+TOgfjvVb90g3luFEgjKlgeuy7hymKVNxFJ aZGUf11PBpylfAxJvRtQDXSn0H4ggTFz6NJp4KCCfumBmVnDtDmABpIFUFDBUp3hDZ19 sCQNyQpqeuOGtDPhzlYueOxEgvjJC96A+4FDqS2pqUOwuQrxgCBqV1KlNQJ8d5PjO/8f zdvA== 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=EU6YGfM/T9Td+Y1kL4coaWtbHVNosu4xsZ4fFiWvMwI=; b=lb/4bk1IrD5LwoACy0lvbSLrKlBG5IdjM5I+u12GgEUKZuFeYQNZOMPn/Cal/3AlF5 yF5YC7xc3250Mmjg5T1a+LLOaZczxG4sVLWGoeguCnFwINzsDxIZ6MThczldpbIDFAUT DGHTqBqMUzbSR9D2/q18ue/oQ6oFw6lvgCSXZCZn6bRIkEsrX8iNjQ/SGmvRw6wKXAG5 3MR1HipJr+whOvuC4pgeIr3lJ9QsOmP3eQ2Fw0uDBLN7YMiTBtj+kI8eypmFfFiZSrwN NXkKNNUaqKhWG1fkX2zpGNy7a9I/DDv3rccWL6SesOM2joz0ktdPS/GktOVVJe4LPWGV mJxg== 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 s22-20020a056402165600b0043a86c4afabsi14172698edx.152.2022.07.12.11.43.51; Tue, 12 Jul 2022 11:43:51 -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 CB54868B8A3; Tue, 12 Jul 2022 21:43:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at03-1.mx.upcmail.net (vie01a-dmta-at03-1.mx.upcmail.net [62.179.121.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1413068B8EC for ; Tue, 12 Jul 2022 21:43:25 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1oBKqx-000M3T-OZ for ffmpeg-devel@ffmpeg.org; Tue, 12 Jul 2022 20:43:23 +0200 Received: from ren-mail-psmtp-mg02. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id BKqxoRe5q8s8UBKqxoLuVH; Tue, 12 Jul 2022 20:43:23 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg02. with ESMTP id BKqxoBsl68eSWBKqxo26pc; Tue, 12 Jul 2022 20:43:23 +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.4 cv=KKE5sHJo c=1 sm=1 tr=0 ts=62cdc0cb a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=ZaQz1PD7fIC24BQSSkEA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 12 Jul 2022 20:43:21 +0200 Message-Id: <20220712184322.22814-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220712184322.22814-1-michael@niedermayer.cc> References: <20220712184322.22814-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfC9NfDjwmRe0TXAqgUS/iGtIrceZtTBi46rRY84ADCQEgiYknGzp/EX4vKMDO/aHY2pF8G/fwkA6bG/Y/BVc2DEt0s+pgOZYx87kMLQqtrrIT3edNWh3 WNo/9Mh4QVOipdtco+o1oAWtunVdKEZwAmofAUC1+gWj8xlwqxJFm58+OHrUC89CGTZW0wYNqNrd6A== Subject: [FFmpeg-devel] [PATCH 2/3] avformat/nutdec: Check get_packetheader() in mainheader 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: iN2YyvQhZ5b+ Fixes; Timeout Fixes: 48794/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6524604713140224 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/nutdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 0db3d03f6c..8cc56615ad 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -200,6 +200,8 @@ static int decode_main_header(NUTContext *nut) int tmp_stream, tmp_mul, tmp_pts, tmp_size, tmp_res, tmp_head_idx; length = get_packetheader(nut, bc, 1, MAIN_STARTCODE); + if (length == (uint64_t)-1) + return AVERROR_INVALIDDATA; end = length + avio_tell(bc); nut->version = ffio_read_varlen(bc);