Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in the underlying Android package com.tom_roush.pdfbox #34

Open
valorbyte opened this issue Feb 9, 2024 · 1 comment
Open

Crash in the underlying Android package com.tom_roush.pdfbox #34

valorbyte opened this issue Feb 9, 2024 · 1 comment

Comments

@valorbyte
Copy link

Certain offending PDF files may cause this native crash:

E/AndroidRuntime( 7710): FATAL EXCEPTION: Thread-6
E/AndroidRuntime( 7710): Process: com.valorbyte.****, PID: 7710
E/AndroidRuntime( 7710): java.lang.StringIndexOutOfBoundsException: length=2; index=2
E/AndroidRuntime( 7710): at java.lang.String.charAt(Native Method)
E/AndroidRuntime( 7710): at com.tom_roush.pdfbox.util.DateConverter.parseDate(DateConverter.java:608)
E/AndroidRuntime( 7710): at com.tom_roush.pdfbox.util.DateConverter.toCalendar(DateConverter.java:676)
E/AndroidRuntime( 7710): at com.tom_roush.pdfbox.util.DateConverter.toCalendar(DateConverter.java:654)
E/AndroidRuntime( 7710): at com.tom_roush.pdfbox.cos.COSDictionary.getDate(COSDictionary.java:816)
E/AndroidRuntime( 7710): at com.tom_roush.pdfbox.pdmodel.PDDocumentInformation.getCreationDate(PDDocumentInformation.java:210)
E/AndroidRuntime( 7710): at dev.aluc.pdf_text.PdfTextPlugin.initDoc(PdfTextPlugin.kt:93)
E/AndroidRuntime( 7710): at dev.aluc.pdf_text.PdfTextPlugin.access$initDoc(PdfTextPlugin.kt:20)
E/AndroidRuntime( 7710): at dev.aluc.pdf_text.PdfTextPlugin$onMethodCall$1.invoke(PdfTextPlugin.kt:53)
E/AndroidRuntime( 7710): at dev.aluc.pdf_text.PdfTextPlugin$onMethodCall$1.invoke(PdfTextPlugin.kt:47)
E/AndroidRuntime( 7710): at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

@valorbyte
Copy link
Author

valorbyte commented Feb 9, 2024

Updating the PDFBox-Android package seems to fix it. Did not test the whole implementation for any breaking changes but works for me. To test use this:

  pdf_text:
    git:
      url: "https://github.com/valorbyte/flutter-pdf-text"
      ref: "c38c46c590ffc4a429f3f3b8fc5cdf8bd572688e"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant