| 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 |
Thread2008.06.19 22:04 "Re: Scalability problem in tif_dirread.c - detecting loops in IFD offsets", by Frank WarmerdamSteve Eddins wrote:
> Does anyone have any thoughts about the cycle detection code in
> tif_dirread.c, or about my ideas for implementing a work-around?
Steve,
There have been files in the wild with IFD loops which (if undetected)
will hang TIFFOpen().
My suggestion would be to alter the libtiff code to:
1) keep track of the IFD offset list allocation size, and only reallocate
in powers of two. This means realloc() is not called for each IFD.
2) keep the IFDs in sorted order.
3) search for ifds in the list using a binary search (fast on ordered values).
This would mean things would scale up to large numbers of IFDs pretty
gracefully (roughly O(nlogn)).
If you use the c library qsort() and bsearch() please be sensitive to
portability issues.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
|
|||||||