Return-Path: <tiff-bounces@remotesensing.org>
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx009.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j4VNv0pr024167
        for <joris.at.lebbeke@skynet.be>; Wed, 1 Jun 2005 01:57:03 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id 98EB125C673B; Tue, 31 May 2005 19:56:38 -0400 (EDT)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from blaster.systems.pipex.net (blaster.systems.pipex.net
	[62.241.163.7])
	by xserve.flids.com (Postfix) with ESMTP id 83A7C25C6718
	for <tiff@remotesensing.org>; Tue, 31 May 2005 19:56:36 -0400 (EDT)
Received: from PLATO (81-178-2-108.dsl.pipex.com [81.178.2.108])
	by blaster.systems.pipex.net (Postfix) with SMTP id 9AB19E00025E;
	Wed,  1 Jun 2005 00:56:35 +0100 (BST)
Message-ID: <02d201c5663c$5fa050a0$0200a8c0@PLATO>
From: "Andy Cave" <andy.cave@hamillroad.com>
To: "Bruno LEDOUX" <brunoledoux@optusnet.com.au>, <tiff@remotesensing.org>
References: <BEC33470.C37A%brunoledoux@optusnet.com.au>
Subject: Re: [Tiff] hot to detect corrupt tif file
Date: Wed, 1 Jun 2005 00:56:22 +0100
Organization: Hamillroad Software
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
	reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
Cc: 
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: Andy Cave <andy.cave@hamillroad.com>
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 000000000023ceae.00000304
X-MSP-STORE: Wed, 01 Jun 2005 01:57:12 --21-99
Status:   

Hi Gordon.

Two things that 'work':

1. Do a basic open on the tiff file. If that succeeds, you've got a good 
chance it's a tiff file.
2. Read the band/tile offsets & sizes, and check that 'they make sense' - 
that is that each band/tile offsets & offset+size lies within the physical 
size of the file (assuming it's a file). If the file is corrupt, there is a 
good chance that this will fail.

After that, the only thing you can do to check there is no corruption, is to 
read each band/tile (and decompress it et al). But that's a lot of overhead.

So, I'd suggest the first 2. We do that with our product FirstPROOF, and it 
seems to be a reasonable catch of corrupt files.

Andy.

Andy Cave,
Chief Executive Officer,
Hamillroad Software Limited.
www.firstproof.com
www.hamillroad.com

----- Original Message ----- 
From: "Bruno LEDOUX" <brunoledoux@optusnet.com.au>
To: <tiff@remotesensing.org>
Sent: Wednesday, June 01, 2005 12:46 AM
Subject: Re: [Tiff] hot to detect corrupt tif file


> Hi Gordon,
>
> Not sure exactly what you mean by "corrupt tiff file".
>
> If you want to check that the CONTENT of a TIFF file hasn't been altered,
> you will have to use an external CRC method like MD5 as there is no such
> thing as a checksum in the TIFF format.
>
> If you want to determine the file format , you can use
> TIFFOpen("file_to_check","r"). If it returns NULL it means the file is NOT 
> a
> TIFF file. If you want to perform more detailed checks it going to be more
> complex considering the number of different tag formats.
>
> HTH,
>
> Bruno.
>
>> Hi,
>> We are trying to find a way to check a tif file and find out whether
>> or not it is a corrupt tif file. Any idea I can do that with libtiff
>> libraries?
>> Thanks,      Gordon
>> _______________________________________________
>> Tiff mailing list: Tiff@remotesensing.org
>> http://xserve.flids.com/mailman/listinfo/tiff
>> http://www.remotesensing.org/libtiff/
>>
>
> _______________________________________________
> Tiff mailing list: Tiff@remotesensing.org
> http://xserve.flids.com/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/
>
>
> 


_______________________________________________
Tiff mailing list: Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
