From patchwork Sat May 30 16:05:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20007 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8277644A43F for ; Sat, 30 May 2020 19:09:29 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8861768AF0D; Sat, 30 May 2020 19:06:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5CC5668AF2D for ; Sat, 30 May 2020 19:06:35 +0300 (EEST) Received: by mail-wm1-f66.google.com with SMTP id r9so6704830wmh.2 for ; Sat, 30 May 2020 09:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2gAqY3ctS+qFf+B5YNkxCDXoHNukU+fc1jIKUdf9TeI=; b=YI9s7qciWVex7ubOUE+j8Z6GLvpQBRnMNtLWcu6SA5qSyaONMbYSXqwuNFXtikxjgM kk9cQHMc7WkVOEWogMb6/9HS9rjTJyAiSll1kDMtAzmoO38u0mjbqeeXuRdDDKr2DeYd M0V0QWD5s0U5K0n4PcngprR4NK0hNOZ3IakXURRUWMH6oW83yKa41vESnddPj162DaXx DIfVoBGitGI+3YzF/rWDpzVPhMyzeOCn9w341DhcKvKWi9/rmxXAmLhD99fmm35jKRyL ioGFny7R22+KHA3z7UxzLbph+pj500OtGG6fggkCwMidFo91iEwcbebodaXAEKG6uVU6 7TDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2gAqY3ctS+qFf+B5YNkxCDXoHNukU+fc1jIKUdf9TeI=; b=PoxTSW2POthat4aIU0fR6Pw81U6ObpxFJe2wt0gPiQgSMxwgDFW2a94S70LF7uYCT+ rpaKkTHf6Ld4DhNcKln075NUfR02dWl7oX+Sd0pu+8u7k1bS2SWhis5JXEDrGB1cpqtA 8w1lo6YtZAoX79QDMsVW+v7yU4/6gKhGpdWYet+F33g9ZgGhCjmH+2wdsshyPTqErb8C DNiCktV+pglyju7VviRoTQjVTJQMqOa8LO3T+oWToSh8T10XcKjwHMtLE/nGLSWJ+vgb 49vTn9cBrEF5kGYGvPs1egI6hoqvZHhBVGWx5ytGFUFK+RQDm37h2Ud9jCMZea0a/fGF 7N+Q== X-Gm-Message-State: AOAM532Rt1EdKlKJYuNuCx6uaCr/XrNfaIaU+msW3L3hdaeVG2FeXcvt +F3XMnFgZdJYHp2+Gxm0NL3Tz6JZ X-Google-Smtp-Source: ABdhPJz1HQAhCswtlTRtBPn8a7zh+1Rltyg9Mw0vnT9EbQU8SwNGZmT3l7y+YiLvIkRehwD9jUZEQw== X-Received: by 2002:a1c:2702:: with SMTP id n2mr14047931wmn.107.1590854794434; Sat, 30 May 2020 09:06:34 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id v27sm15186517wrv.81.2020.05.30.09.06.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 May 2020 09:06:33 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 30 May 2020 18:05:24 +0200 Message-Id: <20200530160541.29517-19-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200530160541.29517-1-andreas.rheinhardt@gmail.com> References: <20200530160541.29517-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 19/36] avcodec/hevc_mp4toannexb_bsf: Use unchecked bytestream2 API X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" We already check manually and error out on invalid data, so we don't have to rely on the implicit checks provided by the safe version of the bytestream2 API. Signed-off-by: Andreas Rheinhardt --- libavcodec/hevc_mp4toannexb_bsf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c index ba1deb2848..634bfe9c46 100644 --- a/libavcodec/hevc_mp4toannexb_bsf.c +++ b/libavcodec/hevc_mp4toannexb_bsf.c @@ -147,14 +147,14 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) goto fail; } for (i = 0; i < s->length_size; i++) - nalu_size = (nalu_size << 8) | bytestream2_get_byte(&gb); + nalu_size = (nalu_size << 8) | bytestream2_get_byteu(&gb); if (nalu_size < 2 || nalu_size > bytestream2_get_bytes_left(&gb)) { ret = AVERROR_INVALIDDATA; goto fail; } - nalu_type = (bytestream2_peek_byte(&gb) >> 1) & 0x3f; + nalu_type = (bytestream2_peek_byteu(&gb) >> 1) & 0x3f; /* prepend extradata to IRAP frames */ is_irap = nalu_type >= 16 && nalu_type <= 23; @@ -176,7 +176,7 @@ static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) if (extra_size) memcpy(out->data + prev_size, ctx->par_out->extradata, extra_size); AV_WB32(out->data + prev_size + extra_size, 1); - bytestream2_get_buffer(&gb, out->data + prev_size + 4 + extra_size, nalu_size); + bytestream2_get_bufferu(&gb, out->data + prev_size + 4 + extra_size, nalu_size); } ret = av_packet_copy_props(out, in);