| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2006.10.27 06:34 "Re: TIFFReadPrivateDirectory function is not working for SUBIFD", by Anurag SinghOn 10/27/06, Sebastian Boehmer <sebastian.boehmer@web.de> wrote:
>
> Hello,
>
> >Yes that's right.
> >The __TIFFReadCustomDirectoryPart function reads only the tags with are
> >"registered" in parameter TIFFFieldInfo** info[]. The parameter size_t*
> >nfields is the size of this array.
> >You have to register the filed with TIFFMergeFieldInfo ...
> >Anyway is it although a question if we should read the tags which are
> >not registered like in TIFFReadDirectory.
> >I think we should. I will correct this next week. So long use the
> >TIFFMergeField function , please.
one another important issue comes, i have made one change in
__TIFFReadCustomDirectoryPart for our own purpose to read subifd, it's very
true that at the time of reading any SubIFD , there's no one tag is
registered, because we are passing these parameters tif->tif_nPrivateFields,
tif->tif_privateFieldInfo, which are initially NULL.
So each n very time tag goes to merge by using TIFFMergePrivateFieldInfo()
and in turn this function make call
__TIFFMergeFieldInfo(&tif->tif_nPrivateFields,&tif->tif_privateFieldInfo,n,info,1)
, after merging 2-3 times , i got HEAP error in this funtion, and reason of
it, mergedIndices is currupted.
i want explain it, we are merging one tag each n every time, so here n=1 and
info have one tag only.
I think problem is here. this is the code of function __TIFFMergeFieldInfo
if ( support ) {
mergedIndices = _TIFFmalloc(n*sizeof(int));
}
if (*nfields > 0) {
if ( support ) {
/*
* Merge only not already existing tags. Asume unsorted TIFFFieldInfo array.
*/
for (fi=0; fi < *nfields; ++fi) {
for (i =0; i < n; ++i)
if (info_new[i].field_tag == (*info)[fi]->field_tag)
break;
if ( i >= n ) { // entry not found
mergedIndices[nn] = i; // remember index
++nn;
}
}
if ( nn == 0 ) goto end; // no new entries;
n = nn;
}
we are allocationg memory to mergedIndices of size n, mean in the SubIFD's
case 1 and adding more than value, here is some logical error for tha case
when only one tag is merged in a group.
Please have a look on this problem.
Anurag
|
|||||||