From patchwork Mon Nov 27 12:07:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 44827 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bca6:b0:181:818d:5e7f with SMTP id fx38csp3276035pzb; Mon, 27 Nov 2023 03:59:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpqIcoqOI/QIz6uAu1o4VFXC7rjZJ+f0czrxmu+OLfc2ce7dcAOxgxZEOcgxj86RBO+J5y X-Received: by 2002:a17:906:6cd:b0:9e6:59d5:80c5 with SMTP id v13-20020a17090606cd00b009e659d580c5mr8597439ejb.23.1701086347803; Mon, 27 Nov 2023 03:59:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701086347; cv=none; d=google.com; s=arc-20160816; b=A8ChiOBtYXkOfCA6eFnyV4bSsues3qkPpIpp7+gw9NhdDoiZZHqRTfxvUmApX5kR28 4PxM0bfGfxyrDKA1HeRPvbqauoubav2rpgb32vtoNFTemfFw2WGC8DkKVviltR8R4xyH 92mdpRnFDe8Z4SxaUG01YuZ+jdrMkQ4eqcAQGMbOFRjXffD7H1Ru48O6Iv4/ijHG988r Hgq/0wkguSb6k+7AeaEEm1RhBSInyAcPDGphN7t/60LM3GxPh7NKb9UwJ3Acani66dO6 AplqRfiJM2cVXi5PRuqaPYqolrVMMzG14q0r53OTUjfUw4x87aXhEA6w9ufDRBtHGQ9b PGTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to; bh=vKeeCc1GZIErumKSIn0ryDC0ioDZrMRtAHo0kziC5xM=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=bEwozJQTCG9TrKPlMqIFCD7G+mmVK3wCIph/eA+LIKPlTvUIZ3+er9ILwQIDSU5fEB i0Mt7ZqNejEDS36C4D7lDksg4kPSLob9viisNdqQIZP9+zA6y4GzZHo+hBkTy7EbX1+k KW1GUOFRNBaZBxxfdl64VGR5pJdW5/FJsGdg8QTKgzUFISnjTbP2Hg5VhN951PvSms0X NJUdP6lhNpWOuwxGR5DLJY89ExQ0uZetSWK4h8KvZU5gFdrIc4Xgx5uOKSXNy8c/wZ6K rVpfrSppQyu3SF4e7AYywHZ1hQ+OXYL/MMlR2mlGhLNMJhiQGCLVbdsorlciJGn4CuUe 8Ifg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="bG0/ARr/"; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id kj4-20020a170907764400b009efe6fdfbd1si4849461ejc.258.2023.11.27.03.59.06; Mon, 27 Nov 2023 03:59:07 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="bG0/ARr/"; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1A67368CC46; Mon, 27 Nov 2023 13:59:04 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com [209.85.222.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2AA2168CC46 for ; Mon, 27 Nov 2023 13:58:56 +0200 (EET) Received: by mail-ua1-f45.google.com with SMTP id a1e0cc1a2514c-7c4bcb4e890so259556241.2 for ; Mon, 27 Nov 2023 03:58:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701086334; x=1701691134; darn=ffmpeg.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=fLKkDQg7Yl45exBJ2GzMO5qmVDhjgImCmxMoXrJOXCE=; b=bG0/ARr/zXPOFpsUeW7BdO5XrduyBQJF/smowOvUKqjeZQ0/uSJiY4Iyg1ws0//l26 piKI80Pz3/QihlnWvo2GuXCZ15pPAcz+ui/DhQOEc11UwKF/AJ3R80BPpXsRx6ZdQPwB OohRS4JF5/bN9Hfj8GE4c/qxQpga52kjIzB2MsYwjKa7Fkr986pFnKbdtnQbFifmt4bO aQN+m0atRINyxkx19lhaDLdsQ6dDVd/UhaoejPBj/8jxnz/X7HaTn/yxswBgFVylEhx4 B1v0LM+ocZVpaKIFkBRZTH0EVCXBYCAzAbJdSRC09zjE5Me8EinS0v5IL2Dmm2c0OhsF QC+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701086334; x=1701691134; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=fLKkDQg7Yl45exBJ2GzMO5qmVDhjgImCmxMoXrJOXCE=; b=wprxvewvsoHg4gj4EnDsQ+PvqCtLsTVAPkCXOI3uvhbHSPbAKpjv35wbFVx9ObOG99 7LT6AxsnYMDJPnY/RVC7T4OjbX9Nuc7LMwyxdheEI030oReZtujtejplV87xkQNDie14 8EBJ4lF6wGhY+ALDtYvATWLHjryML5tWYQCOktgVKeDV4mnKVEMY92GhHEdxi32az0Mh lk515awRdClx3GF2RBefbO3bYXVWlj4nvMcJLXUTRd2KDe3qqgtY28Hq0R2dSsQ3Yynx J/0E5343b1AeXbMiJYOttxOs/LkBrtRS1uiZXxwzhN5UuJ22/GQ26kt1mjC4U6EbDUct P+Lg== X-Gm-Message-State: AOJu0Yw2P54ZxyA406eM01CS4fff01zAtwoLBcdRnKsOhMsp+7sxoytR AaBpsb0qC28lD0TEBXTReIV5JeWjVpVqisG508/PZSBH X-Received: by 2002:a67:f7cb:0:b0:462:71a9:ca66 with SMTP id a11-20020a67f7cb000000b0046271a9ca66mr11819773vsp.18.1701086334411; Mon, 27 Nov 2023 03:58:54 -0800 (PST) MIME-Version: 1.0 From: Paul B Mahol Date: Mon, 27 Nov 2023 13:07:21 +0100 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH] avfilter/framesync: fix OOM case 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1lhHCA/LysoV Attached. From 8ce6bd0090666ef94b0455b7f8f4d3c05e273093 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Mon, 27 Nov 2023 13:04:16 +0100 Subject: [PATCH] avfilter/framesync: fix OOM case Fixes OOM when caller keeps adding frames into filtergraph that reached EOF by other means, for example EOF is signalled by other filter in filtergraph or by buffersink. Signed-off-by: Paul B Mahol --- libavfilter/framesync.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c index 6cb4b21fed..23681b5183 100644 --- a/libavfilter/framesync.c +++ b/libavfilter/framesync.c @@ -354,8 +354,11 @@ static int consume_from_fifos(FFFrameSync *fs) int ff_framesync_activate(FFFrameSync *fs) { + AVFilterContext *ctx = fs->parent; int ret; + FF_FILTER_FORWARD_STATUS_BACK_ALL(ctx->outputs[0], ctx); + ret = framesync_advance(fs); if (ret < 0) return ret; -- 2.42.1