laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
45.56k stars 4.95k forks source link

Cannot Synchronize note with 0x00 (NULL byte) pasted in #5046

Open xlash opened 3 years ago

xlash commented 3 years ago

I copied some notes from a pdf, which replaced https with h<0x00>ps. This null value was saved on the MacOS Client, and my android client was not able to synchronise the notes.

Environment

Joplin version: Revision: f560563 (master) Platform: MacOS OS specifics:

Android 1.8.5

Steps to reproduce

  1. Copy NULL byte to a note
  2. Sync from OS platform version
  3. Attempt sync from android
laurent22 commented 3 years ago

Could you provide the exact steps to get the NULL byte into the note?

xlash commented 3 years ago

Just copied and pasted from a PDF.

image

Attempt to copy this ==> (https://github.com/laurent22/joplin)

xlash commented 3 years ago

nullbyte.pdf

Try copying the links

Unsure the NULL bytes are still preserve after upload to github and download :-S

laurent22 commented 3 years ago

Thanks for sharing the PDF file. There's something funny about the links in that particular file, as if they've been modified so that they can't be clicked (even from the PDF itself). But it's interesting anyway and that kind of data could be the reason for weird sync failures that I've never managed to replicate. I'll look into it and see how to filter these invalid bytes.

xlash commented 3 years ago

A few more details :

PDF was generated from https://github.com/remarkjs/remark then https://github.com/astefanutti/decktape

My MacOS Preview application for pdf is the only one so far copying the NULL byte. Chrome browser or Ubuntu Document Viewer does not .

roman-r-m commented 3 years ago

Btw looks like 0x00 has special meaning at least in commonmark

For security reasons, the Unicode character U+0000 must be replaced with the REPLACEMENT CHARACTER (U+FFFD).

https://spec.commonmark.org/0.24/#insecure-characters

laurent22 commented 3 years ago

Thanks for checking Roman. I would have just stripped it off but I guess we can follow their recommendation then.

laurent22 commented 3 years ago

I couldn't replicate this by copying and pasting the PDF. @xlash any chance you could export your note that was causing problem as JEX and upload it here? If it's a JEX all data should be preserved including NULL bytes and that should make it possible to replicate the problem.