pfalcon / zim-desktop-wiki-markdown

pfalcon's fork of Zim desktop wiki project - quick Markdown format support for notebooks, usability improvements, etc. Everything WIP.
http://zim-wiki.org
GNU General Public License v2.0
30 stars 3 forks source link

Zim crashing hard when accessing this messed up page #6

Closed Korodny closed 2 years ago

Korodny commented 2 years ago

My main Zim-Wiki is pretty big (1800 files and directories, some 175 MB). I created an empty markdown wiki following the instructions you provided, copied my entire wiki into that directory and converted all *.txt files to markdown using zim2markdown.py and a bash script, then opened the result in your Zim version to check the results.

zim2markdown doesn't do a perfect job - some things it just doesn't handle at all, like preformatted text. This page (located at PC:Anleitungen:Büro:Markdown:Syntax in my Wiki) is one of the half-converted ones:

http://gutjahr.hallenradsport-forum.de/files/Syntax.md

Trying to access it from inside your Zim fork completely kills Zim (segfault).

pfalcon commented 2 years ago

What can I say... This may happen. A segfault usually means crash somewhere in GTK+ code, i.e. some bad (rendering) data being fed into it. The question is what's your aim: a) being able to use Zim with your markdown personal wiki, or b) make sure that Zim never crashes, even if you feed complete garbage into it.

My aim is strictly a), good luck to anyone who has the aim of b). So, what I would do here is take offending file and make sure that markup at all makes sense (I see at least 2 issues - there's a header at the beginning, which shouldn't be there for Markdown, and there're triple forward quotes instead of triple backquotes (assuming they're there for preformatted text)). After that, I would "bisect" the file and find what piece specifically makes crash and get rid of it. If you do that and will come up with a small reproduction testcase with markup which makes sense, feel free to share it, someone might look into fixing that.

Korodny commented 2 years ago

Obviously, I'm feeding bad data to the parser - that's the whole point. No code should crash just because it's fed bad data?

pfalcon commented 2 years ago

Well, patches welcome ;-).

Korodny commented 2 years ago

Closing this: It's actually not the parser that is at fault here: Apparently, one of the symptoms of the problem described in #4 is that Zim crashes reproducible with a segfault when clicking on certain pages. 'Fixing' the TreeView also gets rid of the crashes.