From patchwork Wed Dec 27 22:29:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 6996 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp8551522jad; Wed, 27 Dec 2017 14:35:50 -0800 (PST) X-Google-Smtp-Source: ACJfBosLw0W/DL3iGgZYA0X3cucCr5RHelnzm8I6wJmvuJlB5n5dPKpLpJTP+7+OHxT+i8/d697x X-Received: by 10.223.144.110 with SMTP id h101mr31470057wrh.83.1514414149919; Wed, 27 Dec 2017 14:35:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514414149; cv=none; d=google.com; s=arc-20160816; b=eVsnLGYYZ20vngYVn4e03xBhhYe66PcdpEAysra//PpPOb2zQXEAVWvWQVIjpCitV7 G3e//9agVtCJn78KShPq3UAX6b0wqVPENXomUNW0c62D0DiMybJVlEth9gEQkpnMWVqg m2170LzAnby/pfQegTNcJetm3iQwEOVe8NRLCuwpb1488rWi4xM4XgmBPrMUcOQSd2wT HxkA6bkB6vU8JJZIMKCfLtrnH4x/U0eAiqvVZI7ZvLWp8rb3/sLy+UH7K/NpHRs657Zj N9E7KoIJQYia6JoptjpjeXhZHXiv/u4tAimT2uC7r6XEuH0FWz0dWNymbbgbP1GY1MVe Dytw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to :arc-authentication-results; bh=5lnddJ2TXMsVPy1FAZitYvfYxY28/MK8LTM3PZuRv+M=; b=il+UlvooBU4y4nILcit08+fnkE52BHPU0udaVk2O5OWJHT3BIXuObRT3b2KYugja+B LuBY4fKFFBnYpofs2Qb+W5ReQ7fIOLxPPtoj8uVC7NltbNgVaNVJk58YHm/4S+M7ZQVs SqCAkRWEkvxN6CAx+R8sK2rknFnvXnIwuQChmlqRedSq4VQvxd6DpQHxsBAYZ1rZ2tGB zP1Kp1MaIjmlTXr4vZH5wG6o/SupEsQ0kw+LdKOB+D7U2wkJAe97p+XrUkxqIvXhaEGr rJdD5aB9xOiTqask5ByWiP0AVKoQYTGydI3MpXsv75WXyzCzOR/JAOi1pJWUjOs7LSZD gCZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=rMLlz0Vi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 7si14230871wmb.168.2017.12.27.14.35.49; Wed, 27 Dec 2017 14:35:49 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=rMLlz0Vi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BDC696803A3; Thu, 28 Dec 2017 00:35:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f50.google.com (mail-it0-f50.google.com [209.85.214.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D81A86800DF for ; Thu, 28 Dec 2017 00:35:27 +0200 (EET) Received: by mail-it0-f50.google.com with SMTP id d137so26953216itc.2 for ; Wed, 27 Dec 2017 14:35:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=IteSeLoACVTePZuTccawNvwjjAKJUbHh8oecMV3Ki0s=; b=rMLlz0VijAwWWesPCUsFqI8Bjs6JIDsFq3irg3vgE2BY8w4mha5TVuv2pkl4q5i8Tp GLudhSJkU7dTaEbVZ6/NqLjKtOkfHARlmwB6/7LvmLvFK+9DgzrEbcTBk9gFq+1mETOw 3SZThvnaZeu9DKbeUCpeoQGhvpSRt/bmZjLg/8nt6vdwjswSSDmaxWbj0WTU0p1YCDX/ 4HcxtP3D1jFkVwuyz/mV+LL5jqZo1QiwXYuGEh5A76SVfdotbTZ+L9D2C0HiYs+BpGTz zWyJJNhojelps9Te0y+SClnWHjiUMcEhkO58exBost0+QXl1dzqQ38tjqdt0TeKUsePY 4/mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=IteSeLoACVTePZuTccawNvwjjAKJUbHh8oecMV3Ki0s=; b=abQKwDbK8pF3+R/IKaHRo1TNZojFl35XS+P2U5Y5vU1yptd6sJzHqmTzC0vgJXFhOQ k+gP+4iIU1BGwkFtb3TVIMP/2IxJ9rK+4Zgplkj1hBqDupoTXbRoHpdSMqH0GGsWN58r ZKXuDM8HC40iFmkACk2I+XdnkG+D+pJojn9M6874faNfgZxW25AURbq7YE7L9MllkcLP d5EAubjT2ChbIHqcoRKEAh+Qiv+Tgyso5AL04UcbPVRbyAt28IcOkyqA9VGlS8RGvNnT hQxfTKYavif7athtwIiGzLEZ+kpKFgbjF3/ve2T3lvAi5p2sKHHz2/HxelIyZdPio1Mh XMVw== X-Gm-Message-State: AKGB3mJ2BjFRLyUbXD0/dMTz7MVZKEE0VbPL7AZexzy3gTj+82pIhUQ4 tAvzof/spmIvlf42eEPrQQux09nZ8n5DVHnaznc= X-Received: by 10.36.68.76 with SMTP id o73mr36359527ita.4.1514413793633; Wed, 27 Dec 2017 14:29:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.119.211 with HTTP; Wed, 27 Dec 2017 14:29:33 -0800 (PST) From: Carl Eugen Hoyos Date: Wed, 27 Dec 2017 23:29:33 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH]lavc/jpeg2000dec: Support reading 64-bit atom size. 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" Hi! Attached patch fixes ticket #6935 for me, files with actual atom size >= 2^32 cannot be read by the current bytestream system afaict. Please comment, Carl Eugen From db1010aec864cb963fac243907565fdd8c8a1636 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 27 Dec 2017 23:18:58 +0100 Subject: [PATCH] lavc/jpeg2000dec: Support reading 64-bit atom size. Fixes ticket #6935. --- libavcodec/jpeg2000dec.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 8071dc3..01fe4b3 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -2009,7 +2009,16 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s) bytestream2_get_bytes_left(&s->g) >= 8) { atom_size = bytestream2_get_be32u(&s->g); atom = bytestream2_get_be32u(&s->g); - atom_end = bytestream2_tell(&s->g) + atom_size - 8; + if (atom_size == 1) { + if (bytestream2_get_be32u(&s->g)) { + avpriv_request_sample(s->avctx, "Huge atom"); + return 0; + } + atom_size = bytestream2_get_be32u(&s->g); + atom_end = bytestream2_tell(&s->g) + atom_size - 16; + } else { + atom_end = bytestream2_tell(&s->g) + atom_size - 8; + } if (atom == JP2_CODESTREAM) return 1; -- 1.7.10.4