Android Question Crash with pdfrenderer that bypasses the crash handler

Discussion in 'Android Questions' started by Yuri Cinesi, Aug 11, 2018.

  1. Yuri Cinesi

    Yuri Cinesi Member Licensed User

    I'm experiencing a strange behaviour with @DonManfred's pdfrenderer library (which, by the way, is very useful so thank you for making it).

    It seems to cause a crash when trying to render a specific .pdf file.
    Here's what I'm doing in a nutshell: I'm downloading a .pdf file from an URL using an HttpJob. Once the job is done I use the bytestofile function to save it in the DirInternal folder. Once it's saved I use the pdfrenderer to save each page as a .png file. I then construct a string of html code that will display all images in a row and then load that html code into a webview and display it to the user.

    The issue arises with one particular line of code that initializes a bitmap with a page from the pdf file, the line in question being bt.Initialize3(pdfrenderer.renderPageforPrint(cont)). The cont is a counter as this is in a for cycle based on the number of pages. This line crashes the app bypassing the crash handler. I've tried encasing it into a try catch block with no results.

    The extremely strange thing is that this behavior only happens with one specific pdf file, and it can be reproduced without fail. I've attached a small project that displays the behaviour as well as the two pdf files the project downloads in case it's something to do with that specific file (which it probably is but exactly what eludes me).

    Any help is appreciated.

    Oh and I'm using a phone running android 5.0.1.

    Attached Files:

    Last edited: Aug 12, 2018
  2. DonManfred

    DonManfred Expert Licensed User

    Based on the log the App works as expected. At least on my Device (Samsung Note 8, Android 8)
    Crash with which Error exactly?
  3. Yuri Cinesi

    Yuri Cinesi Member Licensed User

    None, that's the issue. Might be related to the version of android I'm running, I'll provide a video of the problem asap
  4. DonManfred

    DonManfred Expert Licensed User

    If the App Crashes then there MUST BE an Error in the Log. At least in the unfiltered log.
    There is no crash without entry in the LOG.
    The Library should work on Android 5+ (Api 21+)
  5. Yuri Cinesi

    Yuri Cinesi Member Licensed User

    Didn't think about unfiltering the log, will do that
  6. Yuri Cinesi

    Yuri Cinesi Member Licensed User

    Here it is.

    cont: 1
    Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 8220 (.PDFRendererBug)
    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'Huawei/ALE-L21/hwALE-H:5.0.1/HuaweiALE-L21/C432B204:user/release-keys'
    Revision: '0'
    ABI: 'arm64'
    pid: 8220, tid: 8220, name: .PDFRendererBug >>> b4a.PDFRendererBug <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    x0 0000000000000000 x1 0000005563575b50 x2 0000000000000f80 x3 0000000000000000
    x4 0000000000000000 x5 00000000201c4001 x6 fffffffffffffff0 x7 80000e0000000100
    x8 322f534f60000300 x9 68010000c095cba0 x10 70616d6360000000 x11 c40f0000cb460d30
    x12 20747663d4020000 x13 201c0000724d9d44 x14 6d67706610020000 x15 0000000000001484
    x16 0000007fb2c5e400 x17 0000007fb2bdae00 x18 0000005563575b20 x19 0000000000001000
    x20 0000007fb2c66c20 x21 f11f590000000000 x22 0000000000000000 x23 0000000000000001
    x24 f11f590000000000 x25 f11f590000000000 x26 0000000000000000 x27 0000007ff11f59d8
    x28 0000007f9660a310 x29 0000007ff11f5810 x30 0000007fb2c13e44
    sp 0000007ff11f5810 pc 0000007fb2bdaf14 pstate 0000000020000000
    #00 pc 0000000000017f14 /system/lib64/ (memcpy+276)
    #01 pc 0000000000050e40 /system/lib64/ (fread+176)
    #02 pc 00000000001e728c /system/lib64/ (FPDFAPI_FT_Stream_ReadAt+80)
    #03 pc 00000000001e5ed4 /system/lib64/ (FPDFAPI_FT_Load_Sfnt_Table+136)
    #04 pc 0000000000241c88 /system/lib64/ (CFPF_SkiaFont::GetFontData(unsigned int, unsigned char*, unsigned int)+36)
    #05 pc 000000000023f9d0 /system/lib64/ (CFX_AndroidFontInfo::GetFontData(void*, unsigned int, unsigned char*, unsigned int)+36)
    #06 pc 0000000000197b4c /system/lib64/ (CFX_FontMapper::FindSubstFont(CFX_ByteString const&, int, unsigned int, int, int, int, CFX_SubstFont*)+2284)
    #07 pc 0000000000195b40 /system/lib64/ (CFX_FontMgr::FindSubstFont(CFX_ByteString const&, int, unsigned int, int, int, int, CFX_SubstFont*)+184)
    #08 pc 0000000000194838 /system/lib64/ (CFX_Font::LoadSubst(CFX_ByteString const&, int, unsigned int, int, int, int, int)+116)
    #09 pc 00000000000d5ec4 /system/lib64/ (CPDF_SimpleFont::LoadCommon()+964)
    #10 pc 00000000000d3568 /system/lib64/ (CPDF_Font::Load()+192)
    #11 pc 00000000000d6724 /system/lib64/ (CPDF_Font::CreateFontF(CPDF_Document*, CPDF_Dictionary*)+308)
    #12 pc 00000000000e54ac /system/lib64/ (CPDF_DocPageData::GetFont(CPDF_Dictionary*, int)+260)
    #13 pc 00000000000ef308 /system/lib64/ (CPDF_StreamContentParser::FindFont(CFX_ByteString const&)+136)
    #14 pc 00000000000ef3d4 /system/lib64/ (CPDF_StreamContentParser::Handle_SetFont()+152)
    #15 pc 00000000000ee7a0 /system/lib64/ (CPDF_StreamContentParser::OnOperator(char const*)+204)
    #16 pc 00000000000f3df0 /system/lib64/ (CPDF_StreamContentParser::parse(unsigned char const*, unsigned int, unsigned int)+296)
    #17 pc 00000000000f55f4 /system/lib64/ (CPDF_ContentParser::Continue(IFX_Pause*)+948)
    #18 pc 00000000000df458 /system/lib64/ (CPDF_PageObjects::ContinueParse(IFX_Pause*)+28)
    #19 pc 000000000009eeac /system/lib64/ (FPDF_LoadPage+112)
    #20 pc 00000000000fe0d4 /system/lib64/
    #21 pc 0000000000e3641c /data/dalvik-cache/arm64/system@framework@boot.oat
    Tombstone written to: /data/tombstones/tombstone_03
    channel '1ff9bd62 b4a.PDFRendererBug/b4a.PDFRendererBug.main (server)' ~ Consumer closed input channel or an error occurred. events=0x9
    channel '1ff9bd62 b4a.PDFRendererBug/b4a.PDFRendererBug.main (server)' ~ Channel is unrecoverably broken and will be disposed!
    Process 8220 exited due to signal (11)
    Attempted to unregister already unregistered input channel '1ff9bd62 b4a.PDFRendererBug/b4a.PDFRendererBug.main (server)'
    Error opening /proc/8220/oom_score_adj; errno=2
    filter receiver for action = android.intent.action.DROPBOX_ENTRY_ADDED
  7. DonManfred

    DonManfred Expert Licensed User

    Seems like the error is happening in a lower Level.
    What android.jar are you using (Level)?
  8. Yuri Cinesi

    Yuri Cinesi Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice