Skip to content

Commit 124e48c

Browse files
octocorvusthestinger
authored andcommitted
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.
1 parent 1a01da8 commit 124e48c

File tree

1 file changed

+4
-4
lines changed
  • app/src/main/java/app/grapheneos/pdfviewer

1 file changed

+4
-4
lines changed

app/src/main/java/app/grapheneos/pdfviewer/Utils.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ public static String parseDate(String date) throws ParseException {
155155
throw new ParseException("Invalid UTC offset minutes", position);
156156
}
157157
position += 2;
158-
}
159158

160-
// Apostrophe shall succeed mm
161-
if (date.charAt(position) != '\'') {
162-
throw new ParseException("Expected apostrophe", position);
159+
// Apostrophe shall succeed mm
160+
if (date.charAt(position) != '\'') {
161+
throw new ParseException("Expected apostrophe", position);
162+
}
163163
}
164164
}
165165

0 commit comments

Comments
 (0)