Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-j.b-one.net (mx-j.one.com [91.198.169.57])
	by mail9.b-one.net (Postfix) with ESMTP id 8DC5B400505
	for <info@awaresystems.be>; Tue, 19 Apr 2011 15:19:41 +0200 (CEST)
Received: by mx-j.b-one.net (Postfix, from userid 106)
	id 82EBDC4E374; Tue, 19 Apr 2011 15:19:41 +0200 (CEST)
X-Virus-Scanned: by one.com
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-j.b-one.net (Postfix) with ESMTP id 9D0501ACF0 for <info@awaresystems.be>;
 Tue, 19 Apr 2011 15:19:40 +0200 (CEST)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id C545B86D16; Tue, 19 Apr 2011
 08:17:05 -0500 (EST)
Received: from mail-vw0-f44.google.com (mail-vw0-f44.google.com
 [209.85.212.44]) by lists.maptools.org (Postfix) with ESMTPS id 5849F86B14
 for <tiff@lists.maptools.org>; Tue, 19 Apr 2011 07:47:06 -0500 (EST)
Received: by vws12 with SMTP id 12so4309846vws.3 for
 <tiff@lists.maptools.org>; Tue, 19 Apr 2011 05:47:05 -0700 (PDT)
Received: by 10.52.75.38 with SMTP id z6mr4023505vdv.210.1303217225516; Tue,
 19 Apr 2011 05:47:05 -0700 (PDT)
Received: from [172.31.56.35] ([144.212.3.4]) by mx.google.com with ESMTPS id
 u10sm1301820vcr.1.2011.04.19.05.47.04 (version=TLSv1/SSLv3 cipher=OTHER);
 Tue, 19 Apr 2011 05:47:04 -0700 (PDT)
Message-ID: <4DAD8447.7060202@gmail.com>
Date: Tue, 19 Apr 2011 08:47:03 -0400
From: Ashish Uthama <newsgroups.ashish.uthama@gmail.com>
User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100329)
MIME-Version: 1.0
To: tiff@lists.maptools.org
References: <4DAC780F.1000803@gmail.com>
In-Reply-To: <4DAC780F.1000803@gmail.com>
Subject: [Tiff] WhiteLevel with 3.9.5
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: newsgroups.ashish.uthama@gmail.com
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>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

Hi folks,
> I am trying to use the 3.9.5 library to handle a DNG file with a subIFD.
> The subIFD has a WhiteLevel tag 
> http://www.awaresystems.be/imaging/tiff/tifftags/whitelevel.html which 
> appears to cause a segfault with 3.9.5 (Used to work fine with 3.7.1).
>
>
> Debugging 3.9.5, I noticed that TIFFSetField at 1739 was called for 
> this tag:
>
> tif_dirread.c:
>
>   1737                           ok = (fip->field_passcount ?
>   1738                               TIFFSetField(tif, dp->tdir_tag, 
> 1, &v32)
>   1739                             : TIFFSetField(tif, dp->tdir_tag, 
> v32));
>
> which cases the memcpy in 506 to fail:
>
> tif_dir.c:
>    497                 if ((fip->field_passcount
>    498                     || fip->field_writecount == TIFF_VARIABLE
>    499                     || fip->field_writecount == TIFF_VARIABLE2
>    500                     || fip->field_writecount == TIFF_SPP
>    501                     || tv->count > 1)
>    502                     && fip->field_tag != TIFFTAG_PAGENUMBER
>    503                     && fip->field_tag != TIFFTAG_HALFTONEHINTS
>    504                     && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING
>    505                     && fip->field_tag != TIFFTAG_DOTRANGE) {
>    506                     _TIFFmemcpy(tv->value, va_arg(ap, void *),
>    507                                 tv->count * tv_size);
>    508                 } else {
>    509                     /*
>    510                      * XXX: The following loop required to handle
>    511                      * TIFFTAG_PAGENUMBER, TIFFTAG_HALFTONEHINTS,
>    512                      * TIFFTAG_YCBCRSUBSAMPLING and 
> TIFFTAG_DOTRANGE tags.
>    513                      * These tags are actually arrays and 
> should be passed as
>    514                      * array pointers to TIFFSetField() 
> function, but actually
>    515                      * passed as a list of separate values. 
> This behaviour
>    516                      * must be changed in the future!
>    517                      */
>
> Based on the comment (510-517), and the description for the tag, I 
> added TIFFTAG_WHITELEVEL after line 505 to skip the memcpy and use the 
> else block to process it.
>
> Would this be the right way to handle this tag?
>
>
> Ashish
>
>
>

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
