From patchwork Wed Nov 6 02:30:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ross X-Patchwork-Id: 52608 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2fe5:b0:4a6:1c7:11b7 with SMTP id kw5csp359098vqb; Tue, 5 Nov 2024 18:30:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV1YInH+xFETp2XhgSWW/RJ1K0iKJh2ZAgDlyX2+9PbnO1XaTy2vl3ot5wGpkut4kqcmzvIMb3lU3GdzSonasvP@gmail.com X-Google-Smtp-Source: AGHT+IE3dO5YoIyuNTbEcFW0VocyYQhMP7RsBJgkS1TeK5qtlglYdvXIQqmUNbyiUn2f9JF7hkIX X-Received: by 2002:a2e:511a:0:b0:2fb:5060:7037 with SMTP id 38308e7fff4ca-2fcbe0ba6famr134257991fa.41.1730860241434; Tue, 05 Nov 2024 18:30:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1730860241; cv=none; d=google.com; s=arc-20240605; b=U0tfZ+1RtLEWNBU6WBPk0KwWe96oxEXMFkdZagDd9VVLzt87P4JuFELL9cnnBjY2nX pkia7DreKHtrE6wQaSFBw4KHKHbklUr06C47hDYeyCgyJGjiGQH6BPkdgFRRPq8SdgFo GZev4GEyK/RjNXrB670Ml7TBd6tOLBu5XJydJpdGqgH1p9rAUK0eYzIXXkAQMqk2NFK3 pE8rgDzcioqTZZS+WSgyLtJc7rOyv769j68gcaMovDY0n+S8/6pzQwBxum4A5sQWsFNh 9hH+7P2F48CdfQxOK5V9JSsFqB9O+WWqR+Pt3dtDsIJV9GAKncxRadwnZ9wuJ5m9RNiu IHNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :in-reply-to:mime-version:references:message-id:to:from:date :delivered-to; bh=E2ctPOPGW+td8UPCzCs/d1acpcwSWmTL7aFXD9zfBxM=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=Dl8wcDclVkQXeMWnZrXx6vlnn7ZVLNREyR9lJpScOyK75GClTws3dupAsszXbVhyvb 7c7G/mnqgCtmqVgb3i6p+FkFtiZ7GeUU9agdcEPrbZf+8ZJmiActMpUh8y5PhEnGVP8N 7VemNqkKQ255D4v8I96TywICwN7wPrin6Wz8O+GddjpkyEu7nifVUdDIQNf9sxG1yLN/ jL2o4fr2l+z8rLAQXKyB3aYgSeXwDm6u1tDXJl254qty7/NhPfQsPmOaG3KcQQqcb6BU LJNB13L1XeHeBfNqaPgTQdFw2qtWFIPWL/WXrJ/dHXpEZif++1ZkEsqiNuomxAUEp1oV UdNA==; dara=google.com 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 38308e7fff4ca-2fdef8863cbsi42853901fa.266.2024.11.05.18.30.41; Tue, 05 Nov 2024 18:30:41 -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; 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 29D1768DDC3; Wed, 6 Nov 2024 04:30:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EB90668DDC3 for ; Wed, 6 Nov 2024 04:30:30 +0200 (EET) Received: from 4a46a2563e7c094deb76c251b5db1a6a ([1.152.104.224]) (authenticated (0 bits)) by mx.sdf.org (8.18.1/8.14.3) with ESMTPSA id 4A62UFLd015601 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Wed, 6 Nov 2024 02:30:27 GMT Date: Wed, 6 Nov 2024 13:30:14 +1100 From: Peter Ross To: ffmpeg-devel@ffmpeg.org Message-ID: <3e6e633e94641a8f4cf2c892576cb38a6d8854b1.1730860181.git.pross@xvid.org> References: MIME-Version: 1.0 In-Reply-To: Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/rv60: check init_get_bits8 return value 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: kzs0w8bPJ8v4 Fixes CID 1634471 --- libavcodec/rv60dec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/rv60dec.c b/libavcodec/rv60dec.c index d68fa66fa7..86c7aefbca 100644 --- a/libavcodec/rv60dec.c +++ b/libavcodec/rv60dec.c @@ -2263,7 +2263,8 @@ static int decode_slice(AVCodecContext *avctx, void *tdata, int cu_y, int thread thread.avg_linesize[1] = 32; thread.avg_linesize[2] = 32; - init_get_bits8(&gb, s->slice[cu_y].data, s->slice[cu_y].size); + if ((ret = init_get_bits8(&gb, s->slice[cu_y].data, s->slice[cu_y].size)) < 0) + return ret; for (int cu_x = 0; cu_x < s->cu_width; cu_x++) { if ((s->avctx->active_thread_type & FF_THREAD_SLICE) && cu_y) @@ -2317,7 +2318,8 @@ static int rv60_decode_frame(AVCodecContext *avctx, AVFrame * frame, if (avpkt->size < header_size) return AVERROR_INVALIDDATA; - init_get_bits8(&gb, avpkt->data + header_size, avpkt->size - header_size); + if ((ret = init_get_bits8(&gb, avpkt->data + header_size, avpkt->size - header_size)) < 0) + return ret; if ((ret = read_frame_header(s, &gb, &width, &height)) < 0) return ret;