Skip to content

Crash on Android since 16kB Memory Alignment #331

@MarvinFischer

Description

@MarvinFischer

Since the library changed to the 16kB Alignment, I get random crashes based on null pointer (see log below). It works when the first document is loaded. Once the same document gets reloaded the app crashes. It is the same behaviour one emulators and physical devices running the latest Android Versions (15+).

Flutter Code:

return PDFView(
      pageFling: false,
      pageSnap: false,
      autoSpacing: true,
      fitPolicy: FitPolicy.BOTH,
      fitEachPage: false,
      onRender: (pages) {
        setState(() {
          _isLoading = false;
        });
      },
      pdfData: bytes
    );
F/libc    (11956): Fatal signal 5 (SIGTRAP), code 128 (SI_KERNEL), fault addr 0x0 in tid 12027 (AsyncTask #1), pid 11956 (<app>)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone64_x86_64/emu64xa:15/AE3A.240806.036/12592187:user/release-keys'
Revision: '0'
ABI: 'x86_64'
Timestamp: 2026-01-21 14:58:45.316278900+0100
Process uptime: 100s
Cmdline: <app>
pid: 11956, tid: 12027, name: AsyncTask #1  >>> <app> <<<
uid: 10219
signal 5 (SIGTRAP), code 128 (SI_KERNEL), fault addr 0x0000000000000000
    rax 0000000000000001  rbx 000072692c8c9eb0  rcx 6d12921bbc429621  rdx 0000000000000002
    r8  00007ffe860f0080  r9  00007ffe860f00a0  r10 00000000001aebb8  r11 0000000000000213
    r12 000072680914c300  r13 000072680914c20c  r14 000072691ca157d0  r15 0000000000000000
    rdi 000072680914bc3c  rsi 000072680914a910
    rbp 000072680914c0b0  rsp 000072680914c088  rip 000072676393d4cd
43 total frames

backtrace:
      #00 pc 00000000002374cd  /data/app/~~sS9OMZYhiJXs0fQp7ma_Og==/app.my-Bl2ZphnCEwTGTCAjEK6KQw==/lib/x86_64/libpdfium.so (BuildId: a6a42a6505013717)
      #01 pc 0000000000350753  /data/app/~~sS9OMZYhiJXs0fQp7ma_Og==/app.my-Bl2ZphnCEwTGTCAjEK6KQw==/lib/x86_64/libpdfium.so (FPDF_InitLibrary+19) (BuildId: a6a42a6505013717)
      #02 pc 0000000000004302  /data/app/~~sS9OMZYhiJXs0fQp7ma_Og==/app.my-Bl2ZphnCEwTGTCAjEK6KQw==/lib/x86_64/libjniPdfium.so (DocumentFile::DocumentFile()+66) (BuildId: f2944f5d57f6d35e75207f7b1275e111d10e74da)
      #03 pc 00000000000043db  /data/app/~~sS9OMZYhiJXs0fQp7ma_Og==/app.my-Bl2ZphnCEwTGTCAjEK6KQw==/lib/x86_64/libjniPdfium.so (Java_com_shockwave_pdfium_PdfiumCore_nativeOpenMemDocument+59) (BuildId: f2944f5d57f6d35e75207f7b1275e111d10e74da)
      #04 pc 000000000022b5eb  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+219) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #05 pc 0000000000212154  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+756) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #06 pc 0000000000474bf5  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+181) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #07 pc 00000000005f92f3  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+2339) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #08 pc 0000000000233101  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+14913) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #09 pc 000000000022d2e5  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+5) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #10 pc 00000000003e21e0  /data/app/~~sS9OMZYhiJXs0fQp7ma_Og==/app.my-Bl2ZphnCEwTGTCAjEK6KQw==/base.apk (com.shockwave.pdfium.PdfiumCore.newDocument+0)
      #11 pc 00000000005f1de9  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238)+505) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #12 pc 00000000005f85f7  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+103) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #13 pc 00000000005f92d9  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+2313) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #14 pc 0000000000233101  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+14913) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #15 pc 000000000022d2e5  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+5) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #16 pc 000000000038ff30  /data/app/~~sS9OMZYhiJXs0fQp7ma_Og==/app.my-Bl2ZphnCEwTGTCAjEK6KQw==/base.apk (com.github.barteksc.pdfviewer.source.ByteArraySource.createDocument+0)
      #17 pc 00000000005f1de9  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238)+505) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #18 pc 00000000005f85f7  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+103) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #19 pc 00000000005f92d9  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+2313) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #20 pc 0000000000233101  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+14913) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #21 pc 000000000022d2e5  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+5) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #22 pc 000000000038a840  /data/app/~~sS9OMZYhiJXs0fQp7ma_Og==/app.my-Bl2ZphnCEwTGTCAjEK6KQw==/base.apk (com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground+0)
      #23 pc 00000000005f1de9  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238)+505) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #24 pc 00000000005f85f7  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+103) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #25 pc 00000000005f92d9  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, bool, art::JValue*)+2313) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #26 pc 0000000000233101  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false>(art::interpreter::SwitchImplContext*)+14913) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #27 pc 000000000022d2e5  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+5) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #28 pc 000000000038a820  /data/app/~~sS9OMZYhiJXs0fQp7ma_Og==/app.my-Bl2ZphnCEwTGTCAjEK6KQw==/base.apk (com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground+0)
      #29 pc 00000000005f1de9  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238)+505) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #30 pc 0000000000987e6e  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+958) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #31 pc 000000000022b77c  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+140) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #32 pc 0000000000262f47  [anon_shmem:dalvik-jit-code-cache] (offset 0x2000000) (android.os.AsyncTask$3.call+215)
      #33 pc 000000000013e3c0  [anon_shmem:dalvik-jit-code-cache] (offset 0x2000000) (java.util.concurrent.FutureTask.run+368)
      #34 pc 000000000013c344  [anon_shmem:dalvik-jit-code-cache] (offset 0x2000000) (java.util.concurrent.ThreadPoolExecutor.runWorker+452)
      #35 pc 000000000013c0ba  [anon_shmem:dalvik-jit-code-cache] (offset 0x2000000) (java.util.concurrent.ThreadPoolExecutor$Worker.run+154)
      #36 pc 0000000000004cd8  [anon_shmem:dalvik-jit-code-cache] (offset 0x2000000) (java.lang.Thread.run+168)
      #37 pc 0000000000212154  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+756) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #38 pc 0000000000474bf5  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+181) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #39 pc 00000000008c5cc3  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1427) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #40 pc 00000000008c5725  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallbackWithUffdGc(void*)+5) (BuildId: 62338b1c62e3991543c9b8b8bae2b361)
      #41 pc 000000000006d62a  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+58) (BuildId: eb58b4d427279994f00c0e1818477e4f)
      #42 pc 0000000000060348  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+56) (BuildId: eb58b4d427279994f00c0e1818477e4f)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions