Crash when called with invalid font

Issue #518 resolved
created an issue
font ='CorruptedFont.ttf') -- Crash!

Comments (6)

  1. hahawoo reporter

    Um... yeah, this really is a non-issue as I'm sure corrupted ttf files don't often exist, and also if it did somehow occur, it would surely occur as soon as the program was run, and it's surely not worth adding any complexity just for this. I think I got overenthusiastic to report it when I noticed something crashed. Sorry about that. :D

  2. Matthias Richter

    I disagree: LÖVE should should throw an error instead of just crash.

    It would be nice if you could upload a file you know causes this issue so we can investigate the problem.

  3. Boolsheet

    I tried loading a JPEG image and LÖVE indeed terminated. It looks like TrueTypeRasterizer.cpp:48 throws an exception if the loading fails and nobody catches it.

    The real problem is figuring out how to handle this. w_newRasterizer could catch it and then throw a Lua error, but that means w_newFont may leak because it has a call to newRasterizer in the middle.

  4. hahawoo reporter

    Actually I discovered this when trying to load something which wasn't a font, then I tried manually removing part of a ttf file and it crashed again, so I don't have any "real world" examples of corrupted fonts.

  5. Log in to comment