fix PDF date parsing issue causing crash

The issue is due to optional time zone offset 'mm' field followed by
apostrophe being absent, but the parser expecting an extra apostrophe
after the time zone 'HH' field apostrophe anyway, causing it go past the
end of the date string.

Fix the issue by only checking for apostrophe if 'mm' field is present.
This commit is contained in:
octocorvus 2024-05-08 03:41:15 +00:00 committed by Daniel Micay
parent 1a01da8abb
commit 124e48c6c8

View File

@ -155,13 +155,13 @@ public class Utils {
throw new ParseException("Invalid UTC offset minutes", position); throw new ParseException("Invalid UTC offset minutes", position);
} }
position += 2; position += 2;
}
// Apostrophe shall succeed mm // Apostrophe shall succeed mm
if (date.charAt(position) != '\'') { if (date.charAt(position) != '\'') {
throw new ParseException("Expected apostrophe", position); throw new ParseException("Expected apostrophe", position);
} }
} }
}
switch (utRel) { switch (utRel) {