Closed calmofthestorm closed 7 months ago
Thanks for reporting. Orgize will automatically validate the parsed struct and panic if any error occurs. It's disabled in release mode for increasing performance. For fuzz test, I believe it was broken after I upgraded to 2018 edition. But I just keep forgetting to fix it.
Oh, I see. I only check for the ascii whitespaces in some functions. But str::trim
actually remove both ascii whitespaces and unicode whitespaces.
This was fixed by ba9c83c. But I decided to keep this issue opened as a remainder and closed it once we replace every u8::is_ascii_whitespace
with char::is_whitespace
.
In general I expect weird unicode values to get "interesting" results, but I'm going to report this since it results in a panic when debug_assertions are enabled.
Each of these characters, alone, as input, results in a panic in debug builds. I recommend running the example below with --release as otherwise calling parse will panic.
Up to you as to whether it's worth fixing. I saw you had a fuzz test in the source tree so I assume that crashes like this might be of interest, but I can also understand not wanting to go down the unicode rabbithole and it's unclear to me how often these actually come up in real use.
The one or two I tested with org-element work correctly -- a headline containing them in the title is parsed correctly.