Browse Source

- if read/seek fails, it returns faked values, resulting in hard errors (HE). Therefore no hard break of checkit_tiff ooccurs and all files will be evaluated in dir mode

development
art1@andreas-romeyke.de 2 years ago
committed by Andreas Romeyke
parent
commit
f25c7eaad5
  1. 30
      src/helper/check_tiffparse.c

30
src/helper/check_tiffparse.c

@ -334,13 +334,15 @@ tag_t TIFFGetRawTagListEntry( ctiff_t * ctif, int tagidx ) {
/* ct_read count of tags (2 Bytes) */
uint32 adress = ctif->ifd0pos+2+tagidx*12;
if (ct_seek(ctif, adress , SEEK_SET) != adress) { /* IFD0 plus 2byte to get IFD-entries, then nth tag */
perror ("TIFF Header ct_seek error");
exit( EXIT_FAILURE );
perror ("TIFF Header ct_seek error, seeking adress from ifd0 for tagid");
//exit( EXIT_FAILURE );
return 0;
}
uint16 tagid;
if ( ct_read( ctif, &tagid, 2) != 2) {
perror ("TIFF Header ct_read error2");
exit( EXIT_FAILURE );
perror ("TIFF Header ct_read error2, reading tagid from ifd0 (2bytes)");
// exit( EXIT_FAILURE );
return 0;
}
if (byteswapped)
TIFFSwabShort(&tagid);
@ -501,12 +503,12 @@ ifd_entry_t TIFFGetRawTagIFDListEntry( ctiff_t * ctif, int tagidx ) {
ifd_entry.value_or_offset = is_error;
uint32 adress=ctif->ifd0pos+2+tagidx*12;
if (ct_seek(ctif, adress, SEEK_SET) !=adress) { /* IFD0 plus 2byte to get IFD-entries, then nth tag */
perror ("TIFF Header ct_read error2");
perror ("TIFF Header ct_seek error, seeking adress from ifd0 for tagid");
return ifd_entry;
}
uint16 tagid;
if ( ct_read( ctif, &tagid, 2) != 2) {
perror ("TIFF Header ct_read error2");
perror ("TIFF Header ct_read error2, reading tagid from ifd0 (2bytes)");
return ifd_entry;
}
if (byteswapped)
@ -514,14 +516,14 @@ ifd_entry_t TIFFGetRawTagIFDListEntry( ctiff_t * ctif, int tagidx ) {
// tag type check
uint16 tagtype;
if ( ct_read( ctif, &tagtype, 2) != 2) {
perror ("TIFF Header ct_read error2");
perror ("TIFF Header ct_read error2, reading tagtype from ifd0 (2bytes)");
return ifd_entry;
}
if (byteswapped)
TIFFSwabShort(&tagtype);
uint32 count;
if ( ct_read( ctif, &count, 4) != 4) {
perror ("TIFF Header ct_read error4");
perror ("TIFF Header ct_read error4, reading count from ifd0 (4bytes)");
return ifd_entry;
}
@ -537,7 +539,7 @@ ifd_entry_t TIFFGetRawTagIFDListEntry( ctiff_t * ctif, int tagidx ) {
uint32 value_or_offset;
if ( ct_read( ctif, &value_or_offset, 4) != 4) {
perror ("TIFF Header ct_read error4");
perror ("TIFF Header ct_read error4, reading value/offset from ifd0 (4bytes)");
return ifd_entry;
}
if (byteswapped)
@ -767,8 +769,9 @@ uint32 get_next_ifd_pos(ctiff_t * ctif, uint32 actual_pos) {
uint16 count;
if ( ct_read( ctif, &count, 2) != 2 ) {
/* FIXME: replace perror/exit with own error handling routine */
perror ("TIFF Header ct_read error2");
exit( EXIT_FAILURE );
perror ("TIFF Header ct_read error2, reading count from ifd0 (2bytes)");
//exit( EXIT_FAILURE );
return 0;
}
if (ctif->isbyteswapped)
@ -777,8 +780,9 @@ uint32 get_next_ifd_pos(ctiff_t * ctif, uint32 actual_pos) {
uint32 offset;
if ( ct_read( ctif, &offset, 4) != 4 ) {
/* FIXME: replace perror/exit with own error handling routine */
perror ("TIFF Header ct_read error3");
exit( EXIT_FAILURE );
perror ("TIFF Header ct_read error3, , reading next ifd offset from ifd0 (4bytes)");
//exit( EXIT_FAILURE );
return 0;
}
if (ctif->isbyteswapped)
TIFFSwabLong(&offset);

Loading…
Cancel
Save