AWARE [SYSTEMS]
AWare Systems, , Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
June 2008

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



New Datamatrix section



Valid HTML 4.01!



Thread

2008.06.19 21:34 "Scalability problem in tif_dirread.c - detecting loops in IFD offsets", by Steve Eddins
2008.06.19 22:04 "Re: Scalability problem in tif_dirread.c - detecting loops in IFD offsets", by Frank Warmerdam
2008.06.20 12:02 "Re: Scalability problem in tif_dirread.c - detecting loops in IFD offsets", by Steve Eddins
2008.06.20 13:38 "Re: Scalability problem in tif_dirread.c - detecting loops in IFD offsets", by Bob Friesenhahn
2008.06.20 17:19 "Re: Scalability problem in tif_dirread.c - detecting loops in IFD offsets", by Andrey Kiselev
2008.06.20 18:19 "Re: Scalability problem in tif_dirread.c - detecting loops in IFD offsets", by Edward Lam
2008.06.22 17:15 "Re: Scalability problem in tif_dirread.c - detecting loops in IFD offsets", by Steve Eddins

2008.06.19 22:04 "Re: Scalability problem in tif_dirread.c - detecting loops in IFD offsets", by Frank Warmerdam

Steve 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