From patchwork Thu Oct 5 19:44:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 44162 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7a24:b0:15d:8365:d4b8 with SMTP id t36csp256970pzh; Thu, 5 Oct 2023 12:45:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHy7JIoyqPvv/cuxYjhVTp3xVX4qjjsiAUvzCw5+ayRizaoNxaonb9rdeKnNwHQ4h7KWt6C X-Received: by 2002:aa7:cf92:0:b0:523:102f:3ce1 with SMTP id z18-20020aa7cf92000000b00523102f3ce1mr5559171edx.10.1696535103433; Thu, 05 Oct 2023 12:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696535103; cv=none; d=google.com; s=arc-20160816; b=TcoDD+1LfJ9wam9gxDMw0ECOzyWpLFx7460+XYmxfXaxi7aEY5AvpXwZBeTASl8kZh Fyv3PByRorOrH+z/ByDaaUKntTEGw+yEyib585gu9rhgG8XBn2J3FdtDAg8gHXPZ0oS+ D0qqhAFVzjcWU66xb4x8uJLFURu2L6EJPrFZpqRV3eE68E20H2x5J8k27ILHaJD2OgR+ TfesbLcrNgVvlXZo9Zxs8S7GSCd22fc0NDKnt9jw9UhToEo+EAB+SIZMr94n7l5X3itg CFkS/dmFsoBImMnbVA+moaq5PY3vXBUZg2gA71PBIWgDnqeFOwFLKQhA1BKBgbnnEphf E7Dw== 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=/BNXDqnv0j4QraFsHlQZaaWDQ2b/hVkte638AHc8uiU=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=Z6A7PqbvjmsD77AHS3XhNLtXiAxg2KxG+tfkXEs9SKD//YOSrGVLEx2AJcF+XUlVGE yqF5eAhR/ULpW/JhFVI5ZP9/1NNvAcR8g53JiHHVpl5KUnt5i0khSwkr8FXFM9C7uoX7 QbTbPdZbZu/nKF40lTa/ocK329p/XGyNSDB6CZ4L2zWgYjjT0DaeRtW5DQd8h1qvpGpZ 20BLqko5dETgfCK1vttz+6/y1oK/B4MB1R75yaHRP1FIGqla+A/QuYUMU/JJ5IFkcMiU sL7SgmNEL+y1IUKLdXGPbVV0aOz7RPDbvmGRaAGpR5mXQCs7hesgSv7ygVslQXQnJBpy o0nw== 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 f12-20020a056402150c00b0052e1f352fd9si973507edw.650.2023.10.05.12.45.03; Thu, 05 Oct 2023 12:45:03 -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 86A1268CBE8; Thu, 5 Oct 2023 22:44:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ECF2868C9A2 for ; Thu, 5 Oct 2023 22:44:42 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0964660006 for ; Thu, 5 Oct 2023 19:44:41 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 5 Oct 2023 21:44:37 +0200 Message-Id: <20231005194440.1678-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231005194440.1678-1-michael@niedermayer.cc> References: <20231005194440.1678-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/5] avformat/usmdec: do not return 0 when no packet was produced 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: BA8Ee9gHQHHX Fixes: Assertion pkt->stream_index < (unsigned)s->nb_streams && "Invalid stream index.\n" failed at libavformat/demux.c:617 Fixes: 62498/clusterfuzz-testcase-minimized-ffmpeg_dem_USM_fuzzer-4734740995112960 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/usmdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/usmdec.c b/libavformat/usmdec.c index 1665eb8e551..b0079a1230c 100644 --- a/libavformat/usmdec.c +++ b/libavformat/usmdec.c @@ -361,7 +361,7 @@ static int64_t parse_chunk(AVFormatContext *s, AVIOContext *pb, ret = avio_skip(pb, FFMAX(0, chunk_size - (ret - chunk_start))); if (ret < 0) return ret; - return 0; + return AVERROR(EAGAIN); } static int usm_read_packet(AVFormatContext *s, AVPacket *pkt)