LottieFiles / dotlottie-rs

A universal, high-performance Lottie and dotLottie player built with Rust. Offers smooth rendering across platforms, low resource consumption, and extensive compatibility. Features FFI bindings for Kotlin, Swift, and WASM for seamless integration in Android, iOS, and Web projects.
https://developers.lottiefiles.com/docs/dotlottie-player/
MIT License
142 stars 8 forks source link

malloc Double free detected when unloading a theme #115

Closed theashraf closed 3 months ago

theashraf commented 5 months ago
   #[test]
    fn test_unload_theme() {
        let player = DotLottiePlayer::new(Config {
            autoplay: true,
            ..create_default_config()
        });

        let theme_id = "test_theme";

        assert!(player.load_dotlottie_data(include_bytes!("assets/test.lottie"), WIDTH, HEIGHT));

        assert!(player.load_theme(theme_id), "Expected theme to load");
        assert!(player.load_theme(""), "Expected theme to unload"); // panic here with "malloc: Double free detected"
    }
hermet commented 5 months ago

@tinyjin, perhaps ThorVG should handle empty string input ("") in addition to nullptr.

theashraf commented 5 months ago

@Hermet

When the user invokes dotLottie_player.load_theme(""), we pass a null pointer to the tvg override function.