[PATCH 3/3] ply-label: Don't crash if label plugin fails

Petr Vorel pvorel at suse.cz
Fri Mar 6 09:40:01 UTC 2020


From: Fabian Vogt <fvogt at suse.com>

The label plugin's create_control function can return NULL if allocation
failed, for example, but ply-label.c ignores that and uses the NULL control,
causing various SEGVs.

Reviewed-by: Petr Vorel <pvorel at suse.cz>
Signed-off-by: Fabian Vogt <fvogt at suse.com>
---
Hi,

this might be better to squash into 1st commit.

Kind regards,
Petr

 src/libply-splash-graphics/ply-label.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libply-splash-graphics/ply-label.c b/src/libply-splash-graphics/ply-label.c
index 9165cb1..73fc526 100644
--- a/src/libply-splash-graphics/ply-label.c
+++ b/src/libply-splash-graphics/ply-label.c
@@ -129,6 +129,15 @@ ply_label_load_plugin (ply_label_t *label)
 
         label->control = label->plugin_interface->create_control ();
 
+        if (label->control == NULL) {
+                ply_save_errno ();
+                label->plugin_interface = NULL;
+                ply_close_module (label->module_handle);
+                label->module_handle = NULL;
+                ply_restore_errno ();
+                return false;
+        }
+
         if (label->text != NULL)
                 label->plugin_interface->set_text_for_control (label->control,
                                                                label->text);
-- 
2.25.1



More information about the plymouth mailing list