From patchwork Sat Jul 13 15:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50530 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1493327vqb; Sat, 13 Jul 2024 11:56:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUNwmfme74oTUkWMC74o7j/ZDzfX43gRdCvPkzrTOFv051JrDGQCcfGOhhwHCdd3TkEtVuT3nxGcSS617MFxLm8/Z46G5H8m3bSkA== X-Google-Smtp-Source: AGHT+IHK/KT93GsV1kbckpCnmi+erSJGY176Gd2aVZcfsoBmTYjgZn874o0ehu9QRgYafrpjwp1f X-Received: by 2002:a05:651c:200f:b0:2ee:8555:4742 with SMTP id 38308e7fff4ca-2eeb30fe842mr85604251fa.27.1720897005184; Sat, 13 Jul 2024 11:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720897005; cv=none; d=google.com; s=arc-20160816; b=DEkiB+GvDTqoMUKdU8Jr510xoi4v5yfnhbfQl8oxTqQjOKQK8gcvNLivhlD+gBC6V8 R9J+2J8Ayhl/vSZqnzZ0tILqr5n9h1Q4sA1f4Avr3Pf8WY3Zde/OBuruN8isnN0bXhIl J2CrGeCz0UN4SuHnFMQaEZ7o37gmnt5/wcHmGUa/Ppy4L4x3NDLZw3Iaj5gRqOGPaBPX g45o8sKPKgNMyP5sJOuj7Kk9B1g/qt6gOEBAVLJa5D4ndTKB+iTNEI86OmRCKTP3WrA3 eTEFW3sIg1mrrV5/yJ4d6wRFPX1oyHNZJjDaqS7JJ4r0K3y2ay6V8BZqX5Z8UnFNPv/O UkZw== 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:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=AvPzX8Pz785xM03p8thc0Ke4gp9bW4WInLxTQvEoEz8=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=alr39ZMKQJKrSmkZSvF/pXYu3q+SYDZS+C5BndBzyCFQvEj+dhOD6P5h9kLxJ5ig5z op54jZ90alY1f/WG+IBeEzIoQDN6PE6KUKoBZqFgJn5J6HgAPC19TKI0w6P3Lb/xV/a3 I3hdv3TpSV/VLgZ1SaAz772jPboosB9Xsv7Zcwj9DT09wJ1of8CKYfHLbI3h3cOSNh6y ayRPqLdt2kp9JHRSDLPAss0vS0aMEgW6fdjEB2iZNXl2+hu2Of8Tck6B43Ah/O/p3LR5 /nGOlTKyFA2Z4UGMU2gUKtu/5TsM4VM6ENE+ohS8C4TCPldnZaq5UFEYszW+RoQdlRpc 9Q7g==; 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=UcZSEzwj; 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 38308e7fff4ca-2eee179d45bsi5027651fa.22.2024.07.13.11.56.44; Sat, 13 Jul 2024 11:56:45 -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=UcZSEzwj; 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 5B9FE68DBE6; Sat, 13 Jul 2024 18:51:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4E81868D9FF for ; Sat, 13 Jul 2024 18:51:08 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id A2B63E0004 for ; Sat, 13 Jul 2024 15:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1720885867; 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: in-reply-to:in-reply-to:references:references; bh=vhZQn6BhPbrYMLCGKPcBKj72dtm/9TQjSpYtxS7N9fY=; b=UcZSEzwjiwYdvxQIeVJ3Qw70yePpDu6i0wwb/mnyRpsmdNJJeMJtIedmFfYnq6vGV/nTOu cg73tO9cyGplvDa2ghRSi6NkdFX4YX3qrOxSS+kxlZaU3+Pl7StRajpw49GQ/zoxewprvW CtNQVx7O6wSBYkQlCYRcqQaQ4XScJ0k8VLPF1PiscFoI9nPOhd1jUDtuGnAd+D1zkcjIY3 /bOfO3+60HABVeKYV7+Eeo86m4uCwBJTohtLlVRiM28Buc462RwristPjSxEMdz9dlBKxt +QvC8OKdyuTYeyJRryQVDsZXpeF2NkpoFyeOuyGUHtYED4qxvXhNsa+Ux8Vyog== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 13 Jul 2024 17:51:04 +0200 Message-ID: <20240713155105.2161442-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240713155105.2161442-1-michael@niedermayer.cc> References: <20240713155105.2161442-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/3] avformat/lmlm4: Eliminate some AVERROR(EIO) 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: OXs3hDJOXEZM Found by code review related to CID732224 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/lmlm4.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index c8355e7a8d6..cec2f7ca051 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -94,16 +94,16 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) { av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n"); - return AVERROR(EIO); + return AVERROR_INVALIDDATA; } if (packet_size > LMLM4_MAX_PACKET_SIZE || packet_size<=8) { av_log(s, AV_LOG_ERROR, "packet size %d is invalid\n", packet_size); - return AVERROR(EIO); + return AVERROR_INVALIDDATA; } frame_size = packet_size - 8; if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) - return AVERROR(EIO); + return ret < 0 ? ret : AVERROR(EIO); avio_skip(pb, padding);