| 1 |
/* 'checkit_tiff' is a conformance checker for baseline TIFFs |
| 2 |
* |
| 3 |
* author: Andreas Romeyke, 2015-2022 |
| 4 |
* licensed under conditions of libtiff |
| 5 |
* (see http://libtiff.maptools.org/misc.html) |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "check.h" |
| 10 |
#include "check_helper.h" |
| 11 |
|
| 12 |
/* check if only one IFD exists */ |
| 13 |
ret_t check_has_only_one_ifd(ctiff_t * ctif) { |
| 14 |
GET_EMPTY_RET(ret); |
| 15 |
TIFP_CHECK( ctif, ret); |
| 16 |
/* next commented lines, because TIFFNumberOfDirectories are in endless loop, |
| 17 |
* if the TIFF file from https://github.com/EasyinnovaSL/DPFManager/blob/develop/src/test/resources/IFD%20struct/Circular%20E.tif |
| 18 |
*/ |
| 19 |
/* seek the image file directory (bytes 4-7) */ |
| 20 |
uint32 offset = get_ifd0_pos(ctif ); |
| 21 |
uint32 IFDn = get_next_ifd_pos( ctif, offset ); |
| 22 |
if (0 == IFDn) { |
| 23 |
ret.returncode=is_valid; |
| 24 |
return ret; |
| 25 |
} else { |
| 26 |
// FIXME: tif_fails? |
| 27 |
ret = set_value_found_ret_formatted_with_returncode(&ret, ifderror_multiple_ifd_detected, "baseline TIFF should have only one IFD, but IFD0 at 0x%08x has pointer to IFDn 0x%08x", offset, IFDn ); |
| 28 |
return ret; |
| 29 |
} |
| 30 |
} |
| 31 |
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ |