Skip to content

Commit

Permalink
Error when Image Height and Width is null
Browse files Browse the repository at this point in the history
  • Loading branch information
samalloing authored Feb 2, 2024
1 parent d745990 commit f7c6e91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2367,13 +2367,20 @@ protected void findImages(RepInfo info) throws IOException {
.get(DICT_KEY_WIDTH);
PdfSimpleObject widObj = (PdfSimpleObject) resolveIndirectObject(
widthBase);
niso.setImageWidth(widObj.getIntValue());
PdfObject heightBase = xobdict
.get(DICT_KEY_HEIGHT);
PdfSimpleObject htObj = (PdfSimpleObject) resolveIndirectObject(
heightBase);
niso.setImageLength(htObj.getIntValue());

if(widObj != null || htObj != null ) {
niso.setImageWidth(widObj.getIntValue());
niso.setImageLength(htObj.getIntValue());
} else {
info.setWellFormed(false);
JhoveMessage message = JhoveMessages.getMessageInstance(
MessageConstants.PDF_HUL_159.getId(),
MessageConstants.PDF_HUL_159.getMessage());
info.setMessage(new ErrorMessage(message)); // PDF-HUL-159
}
// Check for filters to add to the filter
// list
Filter[] filters = ((PdfStream) xob)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,4 @@ PDF-HUL-155 = Error parsing mandatory version number from PDF header.
PDF-HUL-156 = Extension can't be defined as an indirect reference
PDF-HUL-157 = Unexpected exception {0}
PDF-HUL-158 = Unexpected exception {0}
PDF-HUL-159 = Image height and width are manditory properties

0 comments on commit f7c6e91

Please sign in to comment.