X-Account-Key: account1
X-UIDL: 90da0492a2c0028ec6d17b048df79d1f
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:                                                                                 
Received: from lists.maptools.org (localhost [127.0.0.1])
	by mail.howardsilvan.com (Postfix) with ESMTPS id DABC3C42149
	for <faxguy@howardsilvan.com>; Sat, 14 Nov 2015 05:20:23 -0800 (PST)
Received: from lists.maptools.org ([94.23.4.142] helo=lists.maptools.org)
	by fangorn.howardsilvan.com with SMTP (2.3.3); 14 Nov 2015 05:20:23 -0800
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 7160235C026;
	Sat, 14 Nov 2015 08:19:40 -0500 (EST)
Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5])
	by lists.maptools.org (Postfix) with ESMTPS id E22C935C024
	for <tiff@lists.maptools.org>; Sat, 14 Nov 2015 08:19:23 -0500 (EST)
Received: from even-desktop.localnet (unknown [88.162.84.61])
	by smtp5-g21.free.fr (Postfix) with ESMTPS id 59719D48072
	for <tiff@lists.maptools.org>; Sat, 14 Nov 2015 14:19:22 +0100 (CET)
From: Even Rouault <even.rouault@spatialys.com>
To: tiff@lists.maptools.org
Date: Sat, 14 Nov 2015 14:19:20 +0100
User-Agent: KMail/1.13.5 (Linux/2.6.32-67-generic; KDE/4.4.5; x86_64; ; )
MIME-Version: 1.0
Message-Id: <201511141419.20555.even.rouault@spatialys.com>
Subject: [Tiff] ColorMap and high bit depth
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-Assp-ID: fangorn.howardsilvan.com m1-07223-00340
X-Assp-Session: 7F069D3E3A60 (mail 1)
X-Assp-Detected-RIP: 88.162.84.61, 212.27.42.5
X-Assp-Source-IP: 88.162.84.61
X-Assp-Envelope-From: tiff-bounces@lists.maptools.org
X-Assp-Intended-For: faxguy@howardsilvan.com
X-Assp-Version: 2.3.3(14029) on fangorn.howardsilvan.com
X-Assp-Server-TLS: yes
X-Assp-Delay: not delayed (whitelisted); 14 Nov 2015 05:20:23 -0800
X-Assp-Whitelisted: Yes (whitelistdb)
Return-Path: tiff-bounces@lists.maptools.org
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

I've noticed that currently we support ColorMap up to BitsPerSample=28. Since 
3 * 2^28 * sizeof(uint16) = 1.6 GB (< 2 GB, which is the sanity check in 
TIFFReadDirEntryArray() ). And this is read by default at file opening, so it 
can be used as a sort of DoS due to excessive I/O and memory usage.

Does it make sense to support ColorMap with such high bit depths ? Couldn't we 
limit reading ColorTable up to 24 bit for example (which would put the limit 
to 50 MB) ? Another option would be to defer reading the color map until it is 
explicitly requested by the application, but do we need such complication ?

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/


