[SCM] gmerlin/master: patch to prevent segfault when there is no plugin

zmoelnig-guest at users.alioth.debian.org zmoelnig-guest at users.alioth.debian.org
Fri Jan 14 16:32:41 UTC 2011


The following commit has been merged in the master branch:
commit 2e7c1e235666eb4bcc7b75cfc17d99cc31d9409d
Author: IOhannes m zmölnig <zmoelnig at iem.at>
Date:   Fri Jan 14 15:52:52 2011 +0100

    patch to prevent segfault when there is no plugin
    
    when building gmerlin, we most likely don't have any gmerlin plugins installed
    yet, which triggered an array underrun which would have gone unnoticed
    otherwise.

diff --git a/debian/patches/fix_zeroplugins.patch b/debian/patches/fix_zeroplugins.patch
new file mode 100644
index 0000000..80f9c3a
--- /dev/null
+++ b/debian/patches/fix_zeroplugins.patch
@@ -0,0 +1,51 @@
+Author: IOhannes m zmölnig
+Description: prevent segfaults if no plugins can be found
+--- gmerlin.orig/lib/pluginregistry.c
++++ gmerlin/lib/pluginregistry.c
+@@ -174,6 +174,9 @@
+   bg_plugin_info_t ** arr;
+   int num_plugins = 0;
+   int keep_going;
++
++  if(NULL==list)
++    return NULL;
+   
+   /* Count plugins */
+ 
+@@ -216,7 +219,8 @@
+ 
+   for(i = 0; i < num_plugins-1; i++)
+     arr[i]->next = arr[i+1];
+-  arr[num_plugins-1]->next = (bg_plugin_info_t*)0;
++  if(num_plugins>0)
++    arr[num_plugins-1]->next = (bg_plugin_info_t*)0;
+   list = arr[0];
+   /* Free array */
+   free(arr);
+@@ -957,16 +961,18 @@
+   if(ret->singlepic_encoder)
+     ret->entries = append_to_list(ret->entries, ret->singlepic_encoder);
+   
+-  /* Sort */
+-
+-  ret->entries = sort_by_priority(ret->entries);
++  if(ret->entries)
++    {
++    /* Sort */
++    ret->entries = sort_by_priority(ret->entries);
+ 
+-  if(!opt->dont_save)
+-    bg_plugin_registry_save(ret->entries);
+-  
+-  /* Remove duplicate external plugins */
+-  ret->entries = remove_duplicate(ret->entries);
++    if(!opt->dont_save)
++      bg_plugin_registry_save(ret->entries);
+   
++    /* Remove duplicate external plugins */
++    ret->entries = remove_duplicate(ret->entries);
++    }
++
+   /* Kick out unsupported plugins */
+   tmp_info = ret->entries;
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 7d68feb..d2a76f5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,6 +2,7 @@ desktop_files.patch
 fix_manpages.patch
 replace_bg_sem_h.patch
 png_set_gray.patch
+fix_zeroplugins.patch
 function_param_type.patch
 underlinking.patch
 gmerlin_visualizer_slave.patch

-- 
gmerlin packaging



More information about the pkg-multimedia-commits mailing list