From patchwork Thu May 16 22:29:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 13170 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 C77F8449AF9 for ; Fri, 17 May 2019 01:50:14 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B433368A60E; Fri, 17 May 2019 01:50:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2815968A571 for ; Fri, 17 May 2019 01:50:13 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id d18so5074223wrs.5 for ; Thu, 16 May 2019 15:50:13 -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=05g2bbm63DyrQpkYyx6GxIP1o+7N2gdNRloQLz11sAk=; b=T5u3gGk+FzFOgE4F2Rg6Z3owSAAZ9uoviNbF5ornXgvjwWybwzqGoU+/8dajWemTgN 2xiykjTffwQthyVjyPS7P7xgoWFexcKZazLS9jLgqVX8yrNhLCiqSwsRwL81zLPXmQF+ NCmshBC2D5y8rUtxzTX3pe2cuFQGnSRSBujsjvxZsg6ivZL3RgiQNr2Rqw6CGfqq6qSV QWVPR7/sCf5e+NKLBFr5IYXRNJYAX/yzwY/YAIZSbHUkDjc+H6rrAkHP7Y314iNRkhrP e9lWG/G1DoQHaEJkGFaNEFnR78OIubD6MDiZ+QFGQkb82EoG8LhCao/6WRm7NmJLBtrQ OoEg== 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=05g2bbm63DyrQpkYyx6GxIP1o+7N2gdNRloQLz11sAk=; b=THQVaCPPbYPJMoYy987UJZEHt3JiKLqsP2c7mc2H/Ac1OS6B47s7VWyl5nnjRZ4yWy GtskeN25236L9QZst3MIh+QglxdhPvH1vAcjpeJZ7qwX8TpPweKGmvonIegyRzlifDnB B/sAhxY7BCTmiJbkAzGz1bYSDaFWQ+NPmjEJB3SY6XDx7uLCJRtdN1DKOpXtTWUO76an iSv/IBMHOPHWfQ+sE4YH4XFkL+yBJ+b0Hgms5CYkHg4LiKohW42gsTC9kNHyL265bRxD mXBLVDYTfgeDoMO7Rs59QqhmpAqLIFcENLyZUgdgKrDFXqZurldrh6nWO0erGOR4H3sK oWwg== X-Gm-Message-State: APjAAAW/pBIeMUL33fQ+ycYj5HPxGlARQ0gvt7Mu4kgQdpwVnTVpLl+B PjXysoi/XMeoNsrCNfFIu5dEf/Y5 X-Google-Smtp-Source: APXvYqzrcVRpNhvid/7PvCFWValtT42XgHVTj9/KL72zMB9jgQkKOogxe0hPpYJBAK3yyIiVGtBsjg== X-Received: by 2002:adf:c601:: with SMTP id n1mr28149264wrg.49.1558046586427; Thu, 16 May 2019 15:43:06 -0700 (PDT) Received: from localhost.localdomain (ipbcc18715.dynamic.kabel-deutschland.de. [188.193.135.21]) by smtp.gmail.com with ESMTPSA id i185sm11168725wmg.32.2019.05.16.15.43.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 15:43:06 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 May 2019 00:29:50 +0200 Message-Id: <20190516223018.30827-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190516223018.30827-1-andreas.rheinhardt@gmail.com> References: <20190516223018.30827-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/37] avformat/matroskadec: Use generic size check for signed integers 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" and drop the redundant checks contained in ebml_read_uint and ebml_read_sint. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskadec.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 6fd5537f5a..927462d3ad 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -882,9 +882,6 @@ static int ebml_read_uint(AVIOContext *pb, int size, uint64_t *num) { int n = 0; - if (size > 8) - return AVERROR_INVALIDDATA; - /* big-endian ordering; build up number */ *num = 0; while (n++ < size) @@ -901,9 +898,6 @@ static int ebml_read_sint(AVIOContext *pb, int size, int64_t *num) { int n = 1; - if (size > 8) - return AVERROR_INVALIDDATA; - if (size == 0) { *num = 0; } else { @@ -1161,6 +1155,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, { static const uint64_t max_lengths[EBML_TYPE_COUNT] = { [EBML_UINT] = 8, + [EBML_SINT] = 8, [EBML_FLOAT] = 8, // max. 16 MB for strings [EBML_STR] = 0x1000000,