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
1 changed files with 4 additions and 4 deletions

View File

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