Skip to content

Commit

Permalink
TIFF: Continue validation even if data is unaligned
Browse files Browse the repository at this point in the history
Copy of #750 submitted by @david-russo, many thanks. Couldn't sort the conflict from the web UI.

Storing data unaligned to word or byte boundaries can decrease read performance but needn't halt file validation entirely as it doesn't prevent the file from being read. This will allow other potentially more serious issues to also be reported.

This commit also makes the 'byteoffset' configuration option affect the reporting of unaligned IFDs the same way it does unaligned IFD Entry values (by treating them as valid when set to 'true').
  • Loading branch information
carlwilson committed Mar 16, 2023
1 parent 74e6930 commit b2a06e2
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 193 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,12 @@ protected List<IFD> parseIFDs(long offset, RepInfo info,
if ((next & 1) != 0) {
String mess = MessageFormat.format(MessageConstants.TIFF_HUL_59.getMessage(), next);
JhoveMessage message = JhoveMessages.getMessageInstance(MessageConstants.TIFF_HUL_59.getId(), mess);
throw new TiffException(message);
if (_byteOffsetIsValid) {
info.setMessage(new InfoMessage(message));
} else {
info.setMessage(new ErrorMessage(message));
info.setWellFormed(false);
}
}
if (list.size() > 50) {
throw new TiffException(MessageConstants.TIFF_HUL_60);
Expand Down
Loading

0 comments on commit b2a06e2

Please sign in to comment.