[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: a_basic.c
User: ahvezda
Date: 06/08/06 13:04:55
Modified: . a_basic.c
Log:
Applied Patch#1534089: libgeda: bugfix for segfault when loading corrupted
file by Tomaz Solc. Thanks!
Revision Changes Path
1.21 +36 -18 eda/geda/gaf/libgeda/src/a_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: a_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/a_basic.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- a_basic.c 15 Jul 2006 17:00:51 -0000 1.20
+++ a_basic.c 6 Aug 2006 17:04:55 -0000 1.21
@@ -312,6 +312,8 @@
OBJECT* last_complex = NULL;
int itemsread = 0;
+ int embedded_level = 0;
+
/* fill version with default file format version (the current one) */
current_fileformat_ver = FILEFORMAT_VERSION;
@@ -434,19 +436,27 @@
break;
case(START_EMBEDDED):
+
+ if(object_list->type == OBJ_COMPLEX ||
+ object_list->type == OBJ_PLACEHOLDER) {
+
object_list_save = object_list;
- object_list = object_list_save->complex->
- prim_objs;
+ object_list = object_list_save->complex->prim_objs;
- temp_tail =
- w_current->page_current->object_tail;
- temp_parent =
- w_current->page_current->object_parent;
- w_current->page_current->object_parent =
- object_list;
+ temp_tail = w_current->page_current->object_tail;
+ temp_parent = w_current->page_current->object_parent;
+ w_current->page_current->object_parent = object_list;
+
+ embedded_level++;
+ } else {
+ fprintf(stderr, "Read unexpected embedded "
+ "symbol start marker in [%s] :\n>>\n%s<<\n",
+ filename, buf);
+ }
break;
case(END_EMBEDDED):
+ if(embedded_level>0) {
object_list = object_list_save;
/* don't do this since objects are already
* stored/read translated
@@ -455,6 +465,14 @@
*/
w_current->page_current->object_tail = temp_tail;
w_current->page_current->object_parent = temp_parent;
+
+ embedded_level--;
+ } else {
+ fprintf(stderr, "Read unexpected embedded "
+ "symbol end marker in [%s] :\n>>\n%s<<\n",
+ filename, buf);
+ }
+
break;
case(ENDATTACH_ATTR):
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs