thorvg / thorvg

Thor Vector Graphics is a lightweight portable library used for drawing vector-based scenes and animations including SVG and Lottie. It can be freely utilized across various software platforms and applications to visualize graphical contents.

Home Page:https://www.thorvg.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lottie/Marker: Runtime crash when parsing error

tinyjin opened this issue · comments

Marker APIs have potential crash, which use following LottieLoader functions:

  • uint32_t LottieLoader::markersCnt()
  • const char* LottieLoader::markers(uint32_t index)
  • bool LottieLoader::segment(const char* marker, float& begin, float& end)

marker_crash.json

Screenshot 2024-04-15 at 6 14 16 PM

So basically, after parsing the Lottie with invalid marker object. It's going to be runtime crash when those Marker APIs called.

The parser isn't affected by this error, but recently introduced APIs seem not covered.

ThorVG must not make crash even if it has parsing error.

For example

Valid marker object

{
    "tm": 33,
    "cm": "sectionC",
    "dr": 30
}

Invalid marker object (-> crash)

{
    "tm": 33,
    "cm": "sectionC",
    "dr": "error because it's mismatched type"
}