LadybirdBrowser / ladybird

Truly independent web browser
https://ladybird.org
BSD 2-Clause "Simplified" License
10.16k stars 398 forks source link

WebContnet Process Crashes repeatedly attempting to load fonts on MacOS #75

Open johnnye opened 4 weeks ago

johnnye commented 4 weeks ago
VERIFICATION FAILED: !is_error() at ~/ladybird/AK/Error.h:202
0   liblagom-ak.0.0.0.dylib             0x0000000102e008cc ak_verification_failed + 216
1   liblagom-gfx.0.0.0.dylib            0x0000000102f04570 OpenType::Name::string_for_id(OpenType::Name::NameId) const + 788
2   liblagom-gfx.0.0.0.dylib            0x0000000102efe134 OpenType::Font::family() const + 120
3   liblagom-gfx.0.0.0.dylib            0x0000000102efa8d4 void Core::Resource::for_each_descendant_file<Gfx::FontDatabase::load_all_fonts_from_uri(AK::StringView)::$_0>(Gfx::FontDatabase::load_all_fonts_from_uri(AK::StringView)::$_0&&) const::'lambda'(Core::Resource const&)::operator()(Core::Resource const&) const + 308
4   liblagom-gfx.0.0.0.dylib            0x0000000102ef975c Gfx::FontDatabase::load_all_fonts_from_uri(AK::StringView) + 472
5   WebContent                          0x000000010225ef74 Ladybird::FontPlugin::FontPlugin(bool) + 272
6   WebContent                          0x00000001021d3204 serenity_main(Main::Arguments) + 1212
7   WebContent                          0x000000010226bb20 main + 216
8   dyld                                0x00000001939ee0e0 start + 2360
5602790.568 Ladybird(82026): WebContent process crashed!
5602790.568 Ladybird(82026): WebContent has crashed 5 times in quick succession! Not restarting...

Running macOS Sonoma 14.4.1 (23E224), this may be related to #31 but I'm unable to determine that. Built from this commit. https://github.com/LadybirdWebBrowser/ladybird/commit/862fc91b2cf9bee9b7f180cdf930c6c99b5dd053

This happens when opening a new tab.

awesomekling commented 4 weeks ago

Sounds like we're having trouble loading one of the TTF fonts you have installed on your system. We'd first need to figure out which file is failing, so that we can take a closer look at it and understand why our parser gets upset :)

johnnye commented 4 weeks ago

It seems to be Söhne SöhneApp-Dreiviertelfett.ttf from https://klim.co.nz/collections/soehne/ that is causing the issue. Unfortunately, I'm not sure what the licensing is for this font so I can't provide a sample.

johnnye commented 4 weeks ago

As a follow up - this does not happen with the Klim Test font package that is available - these are all OTF fonts though.

ioncorimenia commented 2 weeks ago

For me, running Debian Unstable, this issue is caused by the API PHONÉTIQUE font, as included in the fonts-linex package.

nkutya commented 2 weeks ago

I also have this problem (on Voidlinux in my case), but don't know which font causes it. How do you determine that?

johnnye commented 2 weeks ago

I did some print lines of the font being loaded. Used the stack trace to crib the right class, then recompiled and ran ladybird.

nkutya commented 2 weeks ago

I did some print lines of the font being loaded. Used the stack trace to crib the right class, then recompiled and ran ladybird.

Thanks, that works. Apparently in my case the font it trips on is called "����", which doesn't seem very helpful. The output of fc-list doesn't even feature U+FFFC once, let alone four times in a row.

nkutya commented 2 days ago

OK, so I dug deeper and found that in my case the crash is triggered by the font called ZCOOLXiaoWei-Regular, which is part of google fonts. Since it happens during OpenType::Font::family() call, seems like string_for_id doesn't like something about the strings "站酷小薇体", "ZCOOL XiaoWei" or "站酷小薇体 常规".