From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1AB8940372 for ; Sun, 23 Jan 2022 03:52:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6C69168AFF8; Sun, 23 Jan 2022 05:52:23 +0200 (EET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C78AB68AFF1 for ; Sun, 23 Jan 2022 05:52:15 +0200 (EET) Received: by mail-pl1-f178.google.com with SMTP id c3so12393815pls.5 for ; Sat, 22 Jan 2022 19:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qFaxsloWUUbPnarmNEeto4o/FJFhahnMXWL5MQIrpHU=; b=aRkqJmIyVR9oVNhtMPnEwX9XEqhP4hlbPZBZx9/MVfRuICZmViQnMrp24zijzf3P+N gNoaPfjFkW019iMoVBeJdX5DXzyaEBwJP+Z/EYzeOdIew5dLqHLxCD/9zdwZTOqO40W7 DI92tWC8n5gHR/eDuuqz2GnhQ6MUf/9ccy+SwccMhCYXVlHP0BXwz2lJS6mezf1QqAMH h6e6dQ4QvzDD42elKAHSL+o4JBH1MJst3A46FUZvDOGv0RWFVLi69VQJQN4zCU0wsOLV VMikH6jxG4jjugkn67IMq3MXlt31PS/LRGBopQD6vqN3VU987j4JMA1TZq/jeT2gLxO/ 7cEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qFaxsloWUUbPnarmNEeto4o/FJFhahnMXWL5MQIrpHU=; b=hXqOXaT4F6LmiU1Mb1h6xCCXpLhBVKHgNX6R9FxS2foUw2qTMamVgputdc5K6p4344 I8OM+9bXC9xrhI8n3a9fzjn8B/EvrVQEnPHhpiYmtbuCoJFrndwW6wKP2O7fReUeT/MR CwM+JGhbSLS+m2k0ey+dTFXqoqo8vVCjbHTs06VuYwBBwKEi8Z24BUzKapGmlAHVflou X2LbQbDa8vEZeyWM3VTsKq8PXudyNjPDDiC//RgsYbPmPqj1R0/llehWiTXGhFST+bmc OigENya0ALYmhj0WJ1CKx512ngoZ1ojrMuKLYjtRg2jxLo40PWSo3FF/u9Pal9SyV92k /J6w== X-Gm-Message-State: AOAM530gJERvjeN53YbwTyz6oy/qowtkFwaxsxFRybk6oVtpfRtsB0Fz x3cHnnzk7DprCMz5uBKTsU40Irb7Kh8= X-Google-Smtp-Source: ABdhPJyV4koTPK4BUB0qUGU188MxM1riBpJVdR0Xvg2Zs2Gjq8j8k4fRPv3uGZ3E68SVsE+cpL0bSg== X-Received: by 2002:a17:90a:7e81:: with SMTP id j1mr7450169pjl.14.1642909933743; Sat, 22 Jan 2022 19:52:13 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id f13sm12015747pfc.70.2022.01.22.19.52.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Jan 2022 19:52:13 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 23 Jan 2022 11:51:57 +0800 Message-Id: <1642909918-26903-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1642909918-26903-1-git-send-email-lance.lmwang@gmail.com> References: <1642909918-26903-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/3] avformat/rtpdec: return value check for init_get_bits() 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 Cc: Limin Wang MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_h261.c | 4 +++- libavformat/rtpdec_h263_rfc2190.c | 4 +++- libavformat/rtpdec_latm.c | 4 +++- libavformat/rtpdec_mpeg4.c | 5 ++++- libavformat/rtpdec_qt.c | 4 +++- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libavformat/rtpdec_h261.c b/libavformat/rtpdec_h261.c index a102909..57bc10f 100644 --- a/libavformat/rtpdec_h261.c +++ b/libavformat/rtpdec_h261.c @@ -119,7 +119,9 @@ static int h261_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_h261_ctx } else { /* ebit/sbit values inconsistent, assuming packet loss */ GetBitContext gb; - init_get_bits(&gb, buf, len*8 - ebit); + res = init_get_bits(&gb, buf, len*8 - ebit); + if (res < 0) + return res; skip_bits(&gb, sbit); if (rtp_h261_ctx->endbyte_bits) { rtp_h261_ctx->endbyte |= get_bits(&gb, 8 - rtp_h261_ctx->endbyte_bits); diff --git a/libavformat/rtpdec_h263_rfc2190.c b/libavformat/rtpdec_h263_rfc2190.c index a0f587f..47aaec0 100644 --- a/libavformat/rtpdec_h263_rfc2190.c +++ b/libavformat/rtpdec_h263_rfc2190.c @@ -142,7 +142,9 @@ static int h263_handle_packet(AVFormatContext *ctx, PayloadContext *data, } else { /* Start/end skip bits not matching - missed packets? */ GetBitContext gb; - init_get_bits(&gb, buf, len*8 - ebit); + ret = init_get_bits(&gb, buf, len*8 - ebit); + if (ret < 0) + return ret; skip_bits(&gb, sbit); if (data->endbyte_bits) { data->endbyte |= get_bits(&gb, 8 - data->endbyte_bits); diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c index 104a00a..329b8db 100644 --- a/libavformat/rtpdec_latm.c +++ b/libavformat/rtpdec_latm.c @@ -101,7 +101,9 @@ static int parse_fmtp_config(AVStream *st, const char *value) if (!config) return AVERROR(ENOMEM); ff_hex_to_data(config, value); - init_get_bits(&gb, config, len*8); + ret = init_get_bits(&gb, config, len*8); + if (ret < 0) + return ret; audio_mux_version = get_bits(&gb, 1); same_time_framing = get_bits(&gb, 1); skip_bits(&gb, 6); /* num_sub_frames */ diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c index 34c7950..723b6fc 100644 --- a/libavformat/rtpdec_mpeg4.c +++ b/libavformat/rtpdec_mpeg4.c @@ -124,6 +124,7 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len) { int au_headers_length, au_header_size, i; GetBitContext getbitcontext; + int ret; if (len < 2) return AVERROR_INVALIDDATA; @@ -144,7 +145,9 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len) if (len < data->au_headers_length_bytes) return AVERROR_INVALIDDATA; - init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8); + ret = init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8); + if (ret < 0) + return ret; /* XXX: Wrong if optional additional sections are present (cts, dts etc...) */ au_header_size = data->sizelength + data->indexlength; diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 6723cd1..495a3ec 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -82,7 +82,9 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, * The RTP payload is described in: * http://developer.apple.com/quicktime/icefloe/dispatch026.html */ - init_get_bits(&gb, buf, len << 3); + ret = init_get_bits(&gb, buf, len << 3); + if (ret < 0) + return ret; ffio_init_context(&pb0, (uint8_t*)buf, len, 0, NULL, NULL, NULL, NULL); if (len < 4) -- 1.8.3.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".