From patchwork Sat May 25 11:18:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49250 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:542:0:b0:460:55fa:d5ed with SMTP id 63csp2255222vqf; Sat, 25 May 2024 04:18:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVrDcmPJFU5RpUJF2kaLF6bNR+58D+FaV52Zw7Ovuk1IPn2pdR+uroR4XhFATzkXIDJDqgz2VCP1Trz1TD1HH7XQaHLM1bLZK873A== X-Google-Smtp-Source: AGHT+IFiRelbStuw+nkQeOUJ5wT81qK7opqCveiRSG6mN/eyzlRBTVArcXtCcQvH6qas4k/QKJ/A X-Received: by 2002:a50:a6cf:0:b0:578:6263:727b with SMTP id 4fb4d7f45d1cf-578626375e2mr2054626a12.3.1716635906768; Sat, 25 May 2024 04:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716635906; cv=none; d=google.com; s=arc-20160816; b=lKAxmeJJToTizBbV5Q1NyaI6klwX59JjPU1vZ13uwCqhjKiW0X6RTA9IhbShIknvnj 61aYEDqdqpNpnhNHUcQufye2tG4zAU5Nha2pYHElgUPptr/5t099g3zu5hN74NGFIxGO xvogn+enDlnIL67pEYOYs+gjqROz+XlyxJURZibAlrH4TqzpKqt8NhztacD/ioDJb8xb 60uI7goW0OBelBIuxXZDOXwwmTSuTMDLDnEXTD0SE0qewSKU1joESAA+pFHOFVG2IGyh 6ZhJWQgF6KFi1WQMSMhv76vahHldGSCK9lkID8AF/kERMXsiEaOZZx3s+6qy4tcAwFeW UGmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=mNe91lgll7bHTKgdHSr4atBKROc4mSvrrHcTtLijE24=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=HCULBPikj1K07VSs+A+d8bMqAoMM7JJZRwNFwURhviW8h2R443ASkpdiZIqhOt9LFN OTq5aDM/zmiQOmp12qiUExbzmHBuHD52HB4HZo+keN4ngGmRqLY7CALwjvk22HRNU/xE Szyx+xWCJAKsiyMdvT6Rt7H9xn5RjwtmEjWFFVgN10NX31DtIccL7BYyySy31vu3l7Vp YiTt6qcYEnOGnrBhQJeJK1xsqalyMtg5LVdXxFU+OcGLqmpRwDL+IQEobq1Albn606Sa AEyrOC6jW7WLIwxruEod6DKvObgd6uDN1h7yRxT6zO6JQbUbq6bpoDckgJ+EmXyuiuBu gB1w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=d9aT9QXY; 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 4fb4d7f45d1cf-57869c06c94si646002a12.161.2024.05.25.04.18.26; Sat, 25 May 2024 04:18:26 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=d9aT9QXY; 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 518BD68D50E; Sat, 25 May 2024 14:18:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DFA3668CADA for ; Sat, 25 May 2024 14:18:15 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 047BD40004 for ; Sat, 25 May 2024 11:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1716635895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=tbQfOuiyOdmpv+NNfzik5FF8pkSpuZdoOB92b1v7DHc=; b=d9aT9QXYsHNl+m+4kSXQq1b5eaLHDQUwyQOiTg9Iea2IpytA71MTpZzASQvPIWCk4SP3v/ eQulcg17uJFkHu4KcNjd/lZmmHyv1EZzbTKABqmnbJXCuWZLy1CNRkc21+X8N9Z+O1paJQ E6V8nn0pinfhU3Vyp+Je2b70Xx1o0LcXmzfGGTIPgNWzK+VRNXgUZ7HaAJqt5Q8xQwnyAG lo4dQ/HTnMdFeDTB+sUlnamIYvJno7y88Iy0KMVizWoU++wxtRY3arX7PvW0nVMhn/n3XR +tNw+YiT3cKG2cr0DXL3/kvnTTSnxfoJm1PgwGW9L7nFD3NzDttzhgY9cFrYRQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 25 May 2024 13:18:12 +0200 Message-ID: <20240525111814.2587729-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/3] avformat/file: check for lseek() failure 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: aCTi6DBTyRBj Fixes: CID1559855 Unchecked return value from library Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/file.c b/libavformat/file.c index 0ed4cff266c..e2ef85aa705 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -222,8 +222,10 @@ static int file_close(URLContext *h) FileContext *c = h->priv_data; int ret; - if (c->initial_pos >= 0 && !h->is_streamed) - lseek(c->fd, c->initial_pos, SEEK_SET); + if (c->initial_pos >= 0 && !h->is_streamed) { + if (lseek(c->fd, c->initial_pos, SEEK_SET) < 0) + av_log(h, AV_LOG_DEBUG, "Failed to restore position (%s)\n", av_err2str(AVERROR(errno))); + } ret = close(c->fd); return (ret == -1) ? AVERROR(errno) : 0;