From patchwork Tue Dec 3 17:09:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 16566 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 B228C44ACC9 for ; Tue, 3 Dec 2019 19:09:43 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A16CC68B4C6; Tue, 3 Dec 2019 19:09:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5ED9668B4BB for ; Tue, 3 Dec 2019 19:09:36 +0200 (EET) Received: by mail-wr1-f68.google.com with SMTP id z7so4557943wrl.13 for ; Tue, 03 Dec 2019 09:09:36 -0800 (PST) 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=AXhIXMLJrufD3FAIfBpqL6v1j6FzZlRNeQsN7S/dBtY=; b=YESz/JLt0MZH/RhTM78V17DO9328bglpOi9I0YH/5yCVTfqGeanMAtRhMbCvcJ8Kuk C/G2P7dL4THTsDHzQ9TOq0NqDv3OTDC/n/glDK+flXHepUg0ZoI2fbwGb9v/Khe1HAwg Bpk2lEsHhH6RrHsUHPvpFUrr5EKRNtbMBJ2q8BZMi6br252zxlTYCkv6n8wt31q6pZ8s cQDwkQDJeKjVPF/rAINtsuU9vlwSobtdJZ2Zz8WiMpiwWyR97JEuxlIycE2oDtdVy4ZC YpPXsBX9DsUJ00lljlEDPeQeo3xW7fczZE4DXHdyWk+nyeXat2L7su+y/N/dr/Big9Ct BVdA== 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=AXhIXMLJrufD3FAIfBpqL6v1j6FzZlRNeQsN7S/dBtY=; b=pMHn87rnR3+5+r5UkbgqKMHGpbSsrsOkR5LXzMaRBTiiFYpl6DMCWDuhB0v9IgoClE SrXPhtyeWhDCPbk+mAeO6YvccDlmDvhtnZk/DHAAyCGQ+50nEzn9Aog6yAtXcaYYh6Rb ezX06vh89iShXm4O29CY92Kt5sV3KJVcwBKW+MQw8pgS+jCc9RxaPqP3qK6uH4ijP2wi JUVwNeyXhb0IS9wIWKcTQCXqRnbStNOsG/Rfi3Mipxkbm3Hx5bx/tTrVa/WLyglOXPQq Vm+moCxo12fO1H+oObC+inYJ4LLcYP3MkOCKGChqtz4NRcnb9ImthJHzNEg4Xy8K0EWI Re5A== X-Gm-Message-State: APjAAAXsLkOKJDCQ9oQfBYu9oDnm8EenEG+zt7j0dJnhBDQ+5TE35t3/ 3L362zeABye02PEduMR+Pcd4LlG+ X-Google-Smtp-Source: APXvYqwxoMdBmByDS9chFrXGtAoLpuXGnK2ewLmdwRWBVjK1AepORYOLGrrHljse/aHWEFGAcewkGw== X-Received: by 2002:adf:ffc7:: with SMTP id x7mr6267562wrs.159.1575392975729; Tue, 03 Dec 2019 09:09:35 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08e23.dynamic.kabel-deutschland.de. [188.192.142.35]) by smtp.gmail.com with ESMTPSA id x21sm3513630wmj.44.2019.12.03.09.09.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:09:35 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 3 Dec 2019 18:09:08 +0100 Message-Id: <20191203170910.5310-6-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191203170910.5310-1-andreas.rheinhardt@gmail.com> References: <20191203170910.5310-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/8] 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 --- Same as https://ffmpeg.org/pipermail/ffmpeg-devel/2019-August/248369.html libavformat/matroskadec.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 88c43ee0c1..595d9553a2 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2989,10 +2989,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_size[256], int *laces) { - int n, size = *buf_size; + int n; uint8_t *data = *buf; if (!type) { @@ -3079,7 +3079,6 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, } *buf = data; - *buf_size = size; return 0; } @@ -3574,7 +3573,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 < 0) return res; @@ -3597,11 +3596,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 || @@ -3633,7 +3627,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]; } return 0;