From patchwork Sun Sep 29 16:45:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 15388 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 E0A9C449757 for ; Sun, 29 Sep 2019 19:46:15 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B096B6881DE; Sun, 29 Sep 2019 19:46:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 626A8688162 for ; Sun, 29 Sep 2019 19:46:09 +0300 (EEST) Received: by mail-wr1-f46.google.com with SMTP id v8so8377282wrt.2 for ; Sun, 29 Sep 2019 09:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ow7jHD9J9LOV/Jlw/yfLYXA514REAZaWdhOND1Po+ss=; b=W/c6ZhPMNAMfjbKl6XC0egOYSBxabqtVqUadacAIlsmwF/Tvw6XABt0dZnHFsZ12lz q/PX/nPZzhZHL+bFcIxLLAE50mDhmZSjIUsfXUqaLBEfw1NJ/jkIccyAvrbBKeGKkchI lvoqNrh/dL1Ay06N63BDaDTlUeNyjB71WqxCa9ZT3B4c+SoOqcTbcrLKs+94zXDLRJDD xg8nwW0Ocgj2U/foUftGGn6obJJBiUlvZ93qcMgTfZXooDbYtZq4JVzcYwvgAqmaUDax jU3Eg3fdccQn6rEbQs2DSiSRAtOPxYiRJn6GIgl6OvzGBKU9IfAKgT2Q46JAfuPM9Q75 tdUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ow7jHD9J9LOV/Jlw/yfLYXA514REAZaWdhOND1Po+ss=; b=H83T0eGozGHEeHgze4cNJakmc7eMDaimjPylnOSuV4uUJXaoJWyArU1Ds3fPlPUEJS +SZLGaKOev/5dHuEhDawgoz0gOaMjoM6beAqt4KRLzGynod+yZVqzcJ/m6edAQKBVVtw xo3HK52hG44VqUVBuHRcKY7Bjg1nzFvM19zEp7Ya5lgAm9oqdiHt7gEgoZPgKI0Gpqqq yvKARs4jU8HkvVWxJls9toQJEKZkAO2OgD3sB3CaRzJ3h0NNAn9UEcqoqWLi8rI5qE6Y YA+fMZ4hAFJLnHHmESR8MYtivUa7fGre+/xrtdr2hteQ8l4YM0Fysd2Q9JL48X9QHOjH f7GA== X-Gm-Message-State: APjAAAWuktba23exBtc8Sa8Gr01kRK80F9DwFj6XI4AZPylnqnnv7Qgp UOZrIqCFzurWRJYkd8TmPvRajTedjns= X-Google-Smtp-Source: APXvYqw7D6tkcQDj3OHmGfdcUXczpxe2MasWcEg/dM91kRHnLBNT0vIlXPlINtBrLrbLV8FnxPHnpA== X-Received: by 2002:a05:6000:14c:: with SMTP id r12mr10110706wrx.303.1569775568615; Sun, 29 Sep 2019 09:46:08 -0700 (PDT) Received: from rywe.jkqxz.net (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id s10sm27274658wmf.48.2019.09.29.09.46.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2019 09:46:08 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 29 Sep 2019 17:45:57 +0100 Message-Id: <20190929164605.20835-1-sw@jkqxz.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/8] lavc/cbs_h265: Disallow nonsensically large HVCC NAL arrays 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes CID 1419833. --- libavcodec/cbs_h2645.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 2dc261f7a5..185c458f61 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -695,7 +695,12 @@ static int cbs_h2645_split_fragment(CodedBitstreamContext *ctx, nb_arrays = bytestream2_get_byte(&gbc); for (i = 0; i < nb_arrays; i++) { nal_unit_type = bytestream2_get_byte(&gbc) & 0x3f; + nb_nals = bytestream2_get_be16(&gbc); + if (nb_nals > 64) { + // Too many NALs of this type - the header must be invalid. + return AVERROR_INVALIDDATA; + } start = bytestream2_tell(&gbc); for (j = 0; j < nb_nals; j++) {