From a704f0258aea2a5582078e2a2d3acbe20ed5405d Mon Sep 17 00:00:00 2001 From: Sam Alloing Date: Wed, 15 Nov 2023 16:45:22 +0100 Subject: [PATCH] making the parsing of broken PDFs more robust An extra test to see if a token is numeric before using the value. --- .../java/edu/harvard/hul/ois/jhove/module/PdfModule.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jhove-modules/pdf-hul/src/main/java/edu/harvard/hul/ois/jhove/module/PdfModule.java b/jhove-modules/pdf-hul/src/main/java/edu/harvard/hul/ois/jhove/module/PdfModule.java index 4fe9475e9..34d563296 100644 --- a/jhove-modules/pdf-hul/src/main/java/edu/harvard/hul/ois/jhove/module/PdfModule.java +++ b/jhove-modules/pdf-hul/src/main/java/edu/harvard/hul/ois/jhove/module/PdfModule.java @@ -1531,7 +1531,10 @@ protected boolean readXRefTables(RepInfo info) throws IOException { // (Most likely we've hit the keyword "trailer". break; } - _objCount = ((Numeric) _parser.getNext()).getIntegerValue(); + token = _parser.getNext(); + if (token instanceof Numeric) { + _objCount = ((Numeric) token).getIntegerValue(); + } if (_xref == null) { _xref = new long[_objCount]; }