Radee native lib crash on Document#getOutlineDest() - Page 2 - RadaeePDF.com - Results from #6
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF

TOPIC: Radee native lib crash on Document#getOutlineDest()

Radee native lib crash on Document#getOutlineDest() 2 weeks 1 day ago #14940

  • luca.f
  • luca.f's Avatar
  • Away
  • Moderator
  • Moderator
  • Posts: 57
  • Thank you received: 4
Dear user, the new beta has been released. Let us know if this fixes the issue.
The following user(s) said Thank You: AnypadDev

Please Log in or Create an account to join the conversation.

Radee native lib crash on Document#getOutlineDest() 2 weeks 7 hours ago #14942

  • AnypadDev
  • AnypadDev's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
From a quick test using the beta on the attached file, app no longer crashes. Thank you.

May we ask what CJK character actually triggered the crash? And will the crash happen on other characters?

And by length, what is maximum length? And is there any way we can check this before using the API GetDest() to prevent the crash from happening again?

Thanks

Please Log in or Create an account to join the conversation.

Radee native lib crash on Document#getOutlineDest() 2 weeks 4 hours ago #14943

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 947
  • Karma: 43
  • Thank you received: 29
dear user:
crash not caused by GetDest(), but caused by OutlineItem.GetTitle(); which return label of outline item.
the beta version can max to 4092 utf16 or 8180 utf8-chars, longer than 8180 maybe cut.
that mean max latin chars to 4092, and max utf8 in CJK to 8180.
the old version has buffer 1024 and max to 1023 utf8 chars, if last utf16 char is CJK, when convert to utf8, buffer will be overflow.
the beta version has 8192 buffer size, and cut to 8180.

Please Log in or Create an account to join the conversation.

Last edit: by radaee.

Radee native lib crash on Document#getOutlineDest() 1 week 6 days ago #14947

  • AnypadDev
  • AnypadDev's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0

radaee wrote: the old version has buffer 1024 and max to 1023 utf8 chars, if last utf16 char is CJK, when convert to utf8, buffer will be overflow.
the beta version has 8192 buffer size, and cut to 8180.


Can you explain further?
  • Is the max 1023 utf8 chars per outline title?
  • So if we used utf16, this would be max of 512 utf16 chars?
  • Can you give a computation with our example document? Because the original document actually contains a bookmark item that's longer than the one I attached, but it didn't cause a crash. So I'm wondering if its a specific CJK character? or maybe I computed incorrectly.

From doing a quick Javascript check, the bookmark text has a length of 382, but with UTF encoding, its byte size is only 938.
var str = ...; // the chinese outline text
console.log(str.length); // this prints "317"
console.log(new Blob([str]).size); // this prints "938". Which is below the max 1023 you mentioned

thanks

Please Log in or Create an account to join the conversation.

Radee native lib crash on Document#getOutlineDest() 1 week 6 days ago #14948

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 947
  • Karma: 43
  • Thank you received: 29
sorry, i better checked old codes, and found utf16 has 512 buffer, utf8 has 512 buffer too, not 1024.
this behaviour in JNI wrap codes.
that mean, overflow happen when add utf8 at 511 position.

Please Log in or Create an account to join the conversation.

Last edit: by radaee.

Radee native lib crash on Document#getOutlineDest() 1 week 9 hours ago #14951

  • AnypadDev
  • AnypadDev's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0

radaee wrote: sorry, i better checked old codes, and found utf16 has 512 buffer, utf8 has 512 buffer too, not 1024.
this behaviour in JNI wrap codes.
that mean, overflow happen when add utf8 at 511 position.


Thanks. can you give me an example of a problematic string? I tried an Outline title of 120k English characters but it didn't crash. Then I appended a CJK character at the end, it still didn't crash.

* Do you have a timeline for the next stable release?
* What workaround can you recommend to clients?

Thanks

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum