From patchwork Fri Aug 16 03:05:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 14540 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 9EFA5448852 for ; Fri, 16 Aug 2019 06:13:53 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8762068AD22; Fri, 16 Aug 2019 06:13:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ED0FB68AD0F for ; Fri, 16 Aug 2019 06:13:46 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id 207so2880051wma.1 for ; Thu, 15 Aug 2019 20:13:46 -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=GVVLh3rAs2gfopV8fkl75ksshTgOb9wdvskFSCJ2pEI=; b=WR/rIy4R4NyBOrCP3zwu451eDnm7cQ43bgMSX5W+znrju54zRYXqAdCbYjkNiAkQzC aSCbHVJCfYz5vua5pgKM8+QNdhzn3DL9V+GB3GoWxs0XCs5b3GOlSxk1M/eiQ/Q9+/mO hjSLj8z90KbGjBiy5rLEaWCqeI7WTiTy5qqFT/Lg6AkQOumaHQNqw4guVWYKUiCrVXvu 2K1Yn4t77aIALscr56cq4yL9Y3S+LXD5wdVJP+DnphF0jj0hrsvJMD/ZMMJav39qLNBN WmzbDYOC36KpcNCLbCFAzfZ2yathWCGd9Wli2qbsvnCbUna8QfSxnEIhlTfuCPayBI8/ Fitg== 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=GVVLh3rAs2gfopV8fkl75ksshTgOb9wdvskFSCJ2pEI=; b=F5Zg9zv7zmQvkm0niX/b/BTLdde03MvxohW/aJc+90JJDarNFsPliIPvoSjajyqW5F POhXLYLmxS9WHN0JX2IBBWYnfPcUlbb8GddwR1w0BC+cmEFJLfMn0aBWZfzENgArUqJz E7vLWc55R4HxULB4nlWVq6Zx49LKl5KrJkoFpUqKWfcf/WLJaitfcDHfyOHabVzsT2tP Q01SOAjuuHRjsFUUUk/YKZqKCUHV2pNnNXjB51AG0CYbpaiCNa5lVqjEmBu2n2GcYBLB IDy9bImPeau+2LasR4XCOmqAbvcnedV+auAyCF2BRQzAYhbn+myxchTTriipefDPm4yo FYAA== X-Gm-Message-State: APjAAAU+k5+cNIlfWTSSCXQ0553h3ZR+E8ETOseh3fNgfyA758blGCHd 9hR1vlE809zoff95mOqxNoAa6PBh X-Google-Smtp-Source: APXvYqwSbZDjRJoW1g69iN62bxa5QWIkhq8CtfiFFjb+H2IkVvm9Y0zIbzPDvHS0OCIU+s0xz+RJkA== X-Received: by 2002:a1c:3945:: with SMTP id g66mr4725728wma.139.1565925226078; Thu, 15 Aug 2019 20:13:46 -0700 (PDT) Received: from localhost.localdomain (ipbcc08b69.dynamic.kabel-deutschland.de. [188.192.139.105]) by smtp.gmail.com with ESMTPSA id x20sm8501603wrg.10.2019.08.15.20.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2019 20:13:45 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 16 Aug 2019 05:05:22 +0200 Message-Id: <20190816030531.4775-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816030531.4775-1-andreas.rheinhardt@gmail.com> References: <20190816030531.4775-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/11] avformat/matroskadec: Remove unnecessary check 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" 870e7552 introduced validating the lace sizes when they are parsed and removed the old check; yet when merging this libav commit in 6902c3ac, the old check for whether the frame extends beyond the frame has been kept. It is unnecessary and has been removed. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 25f26da074..5901dbd221 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2996,10 +2996,10 @@ static void matroska_clear_queue(MatroskaDemuxContext *matroska) } static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, - int *buf_size, int type, + int size, int type, uint32_t **lace_buf, int *laces) { - int n, size = *buf_size; + int n; uint8_t *data = *buf; uint32_t *lace_size; @@ -3095,7 +3095,6 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, } *buf = data; - *buf_size = size; return 0; } @@ -3589,7 +3588,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf } } - res = matroska_parse_laces(matroska, &data, &size, (flags & 0x06) >> 1, + res = matroska_parse_laces(matroska, &data, size, (flags & 0x06) >> 1, &lace_size, &laces); if (res) @@ -3613,11 +3612,6 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf for (n = 0; n < laces; n++) { int64_t lace_duration = block_duration*(n+1) / laces - block_duration*n / laces; - if (lace_size[n] > size) { - av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n"); - break; - } - if ((st->codecpar->codec_id == AV_CODEC_ID_RA_288 || st->codecpar->codec_id == AV_CODEC_ID_COOK || st->codecpar->codec_id == AV_CODEC_ID_SIPR || @@ -3649,7 +3643,6 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf if (timecode != AV_NOPTS_VALUE) timecode = lace_duration ? timecode + lace_duration : AV_NOPTS_VALUE; data += lace_size[n]; - size -= lace_size[n]; } end: