[gegl] gegl: Avoid some crashes when providing invalid input and output file



commit 7256de15852c944a68b97a96add8e314d39d6521
Author: Martin Nordholts <martinn src gnome org>
Date:   Wed May 12 21:36:31 2010 +0200

    gegl: Avoid some crashes when providing invalid input and output file
    
    Like in
    
      $ gegl filethatdoesntexist.foo

 gegl/gegl-xml.c                         |    2 ++
 gegl/operation/gegl-operation-context.c |    2 ++
 gegl/process/gegl-processor.c           |    4 +++-
 3 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gegl/gegl-xml.c b/gegl/gegl-xml.c
index dc407a0..ec4fce2 100644
--- a/gegl/gegl-xml.c
+++ b/gegl/gegl-xml.c
@@ -470,6 +470,8 @@ GeglNode *gegl_node_new_from_xml (const gchar *xmldata,
   ParseData            pd   = { 0, };
   GMarkupParseContext *context;
 
+  g_return_val_if_fail (xmldata != NULL, NULL);
+
   pd.ids       = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
   pd.refs      = NULL;
   pd.path_root = path_root;
diff --git a/gegl/operation/gegl-operation-context.c b/gegl/operation/gegl-operation-context.c
index 28f0c72..c75336b 100644
--- a/gegl/operation/gegl-operation-context.c
+++ b/gegl/operation/gegl-operation-context.c
@@ -74,6 +74,8 @@ gegl_operation_context_set_property (GeglOperationContext *context,
   GParamSpec *pspec;
   GValue     *storage;
 
+  g_return_if_fail (context != NULL);
+
   pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (context->operation)), property_name);
 
   if (!pspec)
diff --git a/gegl/process/gegl-processor.c b/gegl/process/gegl-processor.c
index 08cde35..538f031 100644
--- a/gegl/process/gegl-processor.c
+++ b/gegl/process/gegl-processor.c
@@ -340,7 +340,8 @@ gegl_processor_set_rectangle (GeglProcessor       *processor,
   /* if the node's operation is a sink and it needs the full content then
    * a context will be set up together with a cache and
    * needed and result rectangles */
-  if (GEGL_IS_OPERATION_SINK (processor->node->operation) &&
+  if (processor->node &&
+      GEGL_IS_OPERATION_SINK (processor->node->operation) &&
       gegl_operation_sink_needs_full (processor->node->operation))
     {
       GeglCache *cache;
@@ -608,6 +609,7 @@ gegl_processor_render (GeglProcessor *processor,
     }
   else
     {
+      g_return_val_if_fail (processor->input != NULL, FALSE);
       valid_region = gegl_node_get_cache (processor->input)->valid_region;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]