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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-354-gbeeb987)



The branch, master has been updated
       via  beeb987b7d7858bbc4956f8f2d9a5fd4a894a158 (commit)
       via  38ce8aae73beec00d603e4cda0ca5eee738a3cb8 (commit)
      from  617797b5a47d370c4fee19110c826502b7e3082b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gattrib/src/s_object.c      |    3 +--
 gschem/src/o_delete.c       |    3 +--
 libgeda/include/prototype.h |    1 +
 libgeda/src/a_basic.c       |   11 +++++++----
 libgeda/src/o_net_basic.c   |    3 +--
 libgeda/src/s_page.c        |   14 ++++++++++++++
 6 files changed, 25 insertions(+), 10 deletions(-)


=================
 Commit Messages
=================

commit beeb987b7d7858bbc4956f8f2d9a5fd4a894a158
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Tue Dec 9 19:28:34 2008 +0000

    libgeda: Check for NULL before updating slots after attaching attribs
    
    If reading a file which contains an illegal object type (which fails to
    read), then contains syntax attaching attributes to that object, we may
    attempt to update the slot on a NULL, or incorrect object.
    
    Updating slots on the wrong object is harmless, but causes a crash for
    NULL objects. Check for the NULL pointer before doing the update.
    
    Also check for NULL before handling embedded object data, and set
    new_obj to NULL when we read an invalid object.

:100644 100644 dad14c3... ef372bd... M	libgeda/src/a_basic.c

commit 38ce8aae73beec00d603e4cda0ca5eee738a3cb8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Tue Dec 9 19:23:22 2008 +0000

    libgeda: Abstract removing objects from the page with s_page_remove ()

:100644 100644 23a415a... bb4e2b4... M	gattrib/src/s_object.c
:100644 100644 5613427... 690c549... M	gschem/src/o_delete.c
:100644 100644 910707b... 68abdb4... M	libgeda/include/prototype.h
:100644 100644 8497da1... 0301704... M	libgeda/src/o_net_basic.c
:100644 100644 0aa3e29... 7814c2b... M	libgeda/src/s_page.c

=========
 Changes
=========

commit beeb987b7d7858bbc4956f8f2d9a5fd4a894a158
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Tue Dec 9 19:28:34 2008 +0000

    libgeda: Check for NULL before updating slots after attaching attribs
    
    If reading a file which contains an illegal object type (which fails to
    read), then contains syntax attaching attributes to that object, we may
    attempt to update the slot on a NULL, or incorrect object.
    
    Updating slots on the wrong object is harmless, but causes a crash for
    NULL objects. Check for the NULL pointer before doing the update.
    
    Also check for NULL before handling embedded object data, and set
    new_obj to NULL when we read an invalid object.

diff --git a/libgeda/src/a_basic.c b/libgeda/src/a_basic.c
index dad14c3..ef372bd 100644
--- a/libgeda/src/a_basic.c
+++ b/libgeda/src/a_basic.c
@@ -390,8 +390,9 @@ GList *o_read_buffer (TOPLEVEL *toplevel, GList *object_list,
         }
 
         /* slots only apply to complex objects */
-        if (new_obj->type == OBJ_COMPLEX ||
-            new_obj->type == OBJ_PLACEHOLDER) {
+        if (new_obj != NULL &&
+            (new_obj->type == OBJ_COMPLEX ||
+             new_obj->type == OBJ_PLACEHOLDER)) {
           o_attrib_slot_update (toplevel, new_obj);
         }
 
@@ -401,8 +402,9 @@ GList *o_read_buffer (TOPLEVEL *toplevel, GList *object_list,
       case(START_EMBEDDED):
         new_obj = object_list->data;
 
-        if (new_obj->type == OBJ_COMPLEX ||
-            new_obj->type == OBJ_PLACEHOLDER) {
+        if (new_obj != NULL &&
+            (new_obj->type == OBJ_COMPLEX ||
+             new_obj->type == OBJ_PLACEHOLDER)) {
 
           object_list_save = object_list;
           object_list = new_obj->complex->prim_objs;
@@ -468,6 +470,7 @@ GList *o_read_buffer (TOPLEVEL *toplevel, GList *object_list,
       default:
         fprintf(stderr, _("Read garbage in [%s] :\n>>\n%s<<\n"),
                 name, line);
+        new_obj = NULL;
         break;
     }
 

commit 38ce8aae73beec00d603e4cda0ca5eee738a3cb8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Tue Dec 9 19:23:22 2008 +0000

    libgeda: Abstract removing objects from the page with s_page_remove ()

diff --git a/gattrib/src/s_object.c b/gattrib/src/s_object.c
index 23a415a..bb4e2b4 100644
--- a/gattrib/src/s_object.c
+++ b/gattrib/src/s_object.c
@@ -341,8 +341,7 @@ OBJECT *s_object_attrib_add_attrib_in_object(TOPLEVEL * pr_current, char *text_s
  *------------------------------------------------------------------*/
 void s_object_delete_text_object_in_object(TOPLEVEL * pr_current, OBJECT * text_object)
 {
-  pr_current->page_current->object_list =
-    g_list_remove (pr_current->page_current->object_list, text_object);
+  s_page_remove (pr_current->page_current, text_object);
   s_delete(pr_current, text_object);
   pr_current->page_current->CHANGED = 1;
 }
diff --git a/gschem/src/o_delete.c b/gschem/src/o_delete.c
index 5613427..690c549 100644
--- a/gschem/src/o_delete.c
+++ b/gschem/src/o_delete.c
@@ -54,8 +54,7 @@ void o_delete (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
   o_erase_single (w_current, object);
   o_erase_grips (w_current, object);
 
-  toplevel->page_current->object_list =
-    g_list_remove (toplevel->page_current->object_list, object);
+  s_page_remove (toplevel->page_current, object);
   s_delete (toplevel, object);
 
   if (do_conn) {
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 910707b..68abdb4 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -414,6 +414,7 @@ void s_page_clear_changed (GedaPageList *list);
 void s_page_autosave_init(TOPLEVEL *toplevel);
 gint s_page_autosave (TOPLEVEL *toplevel);
 void s_page_append (PAGE *page, OBJECT *object);
+void s_page_remove (PAGE *page, OBJECT *object);
 
 /* s_papersizes.c */
 int s_papersizes_add_entry(char *new_papersize, int width, int height);
diff --git a/libgeda/src/o_net_basic.c b/libgeda/src/o_net_basic.c
index 8497da1..0301704 100644
--- a/libgeda/src/o_net_basic.c
+++ b/libgeda/src/o_net_basic.c
@@ -586,8 +586,7 @@ int o_net_consolidate_segments(TOPLEVEL *toplevel, OBJECT *object)
           }
 
           s_conn_remove(toplevel, other_object);
-          toplevel->page_current->object_list =
-            g_list_remove (toplevel->page_current->object_list, other_object);
+          s_page_remove (toplevel->page_current, other_object);
           s_delete(toplevel, other_object);
           o_net_recalc(toplevel, object);
           s_tile_update_object(toplevel, object);
diff --git a/libgeda/src/s_page.c b/libgeda/src/s_page.c
index 0aa3e29..7814c2b 100644
--- a/libgeda/src/s_page.c
+++ b/libgeda/src/s_page.c
@@ -523,3 +523,17 @@ void s_page_append (PAGE *page, OBJECT *object)
 {
   page->object_list = g_list_append (page->object_list, object);
 }
+
+/*! \brief Remove an OBJECT from the PAGE
+ *
+ *  \par Function Description
+ *  Removes the passed OBJECT from the PAGE's
+ *  linked list of objects.
+ *
+ *  \param [in] page    The PAGE the object is being removed from.
+ *  \param [in] object  The OBJECT being removed from the page.
+ */
+void s_page_remove (PAGE *page, OBJECT *object)
+{
+  page->object_list = g_list_remove (page->object_list, object);
+}




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs