OpenMiInk/third_party/krita-deps-management/ext_mlt/0002-MLT-check-pointers-before-dereferencing.patch
Hellings b8c8ff98e2 Hi
2026-10-16 09:05:56 -04:00

49 lines
1.6 KiB
Diff

From e6128e51dc3a19e0e8a563ee95148542bc53ed99 Mon Sep 17 00:00:00 2001
From: Halla Rempt <halla@valdyas.org>
Date: Fri, 26 Jan 2024 20:03:28 +0100
Subject: [PATCH 2/4] MLT: check pointers before dereferencing
In other places, checks for "self" occur as well, so it probably
should be checked everywhere.
This prevents MLT from crashing if it cannot find plugins on creating
an image in Krita. It's still not good that MLT cannot find plugins
in a reliable way, though...
---
src/framework/mlt_consumer.c | 2 ++
src/framework/mlt_service.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c
index e7957b7c..e2cf0dd9 100644
--- a/src/framework/mlt_consumer.c
+++ b/src/framework/mlt_consumer.c
@@ -590,6 +590,8 @@ int mlt_consumer_put_frame(mlt_consumer self, mlt_frame frame)
{
int error = 1;
+ if (!self) return error;
+
// Get the service associated to the consumer
mlt_service service = MLT_CONSUMER_SERVICE(self);
diff --git a/src/framework/mlt_service.c b/src/framework/mlt_service.c
index 24bc8030..00e917ba 100644
--- a/src/framework/mlt_service.c
+++ b/src/framework/mlt_service.c
@@ -321,9 +321,11 @@ int mlt_service_insert_producer(mlt_service self, mlt_service producer, int inde
int mlt_service_disconnect_producer(mlt_service self, int index)
{
+ if (!self) return -1;
+
mlt_service_base *base = self->local;
- if (base->in && index >= 0 && index < base->count) {
+ if (base && base->in && index >= 0 && index < base->count) {
mlt_service current = base->in[index];
if (current) {
--
2.54.0