diff options
author | Su Laus <sulau@freenet.de> | 2021-11-26 15:02:35 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2021-11-26 15:02:35 +0000 |
commit | 7db4f2b62206b9cba6cda538e0f296df0ac371bd (patch) | |
tree | 395b0eb2770e4b403fc495cde33a96dda7a2d94e /tools/tiffinfo.c | |
parent | 29219a5bd14040d60e376324a52ef91b68808143 (diff) | |
download | libtiff-git-7db4f2b62206b9cba6cda538e0f296df0ac371bd.tar.gz |
Fix Segmentation fault printing GPS directory if Altitude tag is present (tif_print.c/tiffinfo.c)
Diffstat (limited to 'tools/tiffinfo.c')
-rw-r--r-- | tools/tiffinfo.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/tiffinfo.c b/tools/tiffinfo.c index 6921a0c5..12cd108c 100644 --- a/tools/tiffinfo.c +++ b/tools/tiffinfo.c @@ -155,12 +155,22 @@ main(int argc, char* argv[]) } else { do { toff_t offset=0; - + uint16_t curdir = TIFFCurrentDirectory(tif); + printf("=== TIFF directory %d ===\n", curdir); tiffinfo(tif, order, flags, 1); if (TIFFGetField(tif, TIFFTAG_EXIFIFD, - &offset)) { + &offset)) { if (TIFFReadEXIFDirectory(tif, offset)) { tiffinfo(tif, order, flags, 0); + /*-- Go back to previous directory, (directory is reloaded from file!) */ + TIFFSetDirectory(tif, curdir); + } + } + if (TIFFGetField(tif, TIFFTAG_GPSIFD, + &offset)) { + if (TIFFReadGPSDirectory(tif, offset)) { + tiffinfo(tif, order, flags, 0); + TIFFSetDirectory(tif, curdir); } } } while (TIFFReadDirectory(tif)); |