File: fix_segfault.patch

package info (click to toggle)
dia2code 0.8.3-4.3
  • links: PTS
  • area: main
  • in suites: sid, trixie
  • size: 968 kB
  • sloc: ansic: 5,682; sh: 716; makefile: 19
file content (39 lines) | stat: -rw-r--r-- 1,818 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Description: Fix segmentation fault with big UML packages
Author: Francesco Aloe <francescoaloe4gnulinux@gmail.com>
Forwarded: not-needed
Last-Update: 2010-04-24

diff -ruN orig/dia2code-0.8.3/dia2code/parse_diagram.c dia2code-0.8.3/dia2code/parse_diagram.c
--- orig/dia2code-0.8.3/dia2code/parse_diagram.c	2003-03-05 17:44:38.000000000 +0100
+++ dia2code-0.8.3/dia2code/parse_diagram.c	2010-04-24 16:18:25.000000000 +0200
@@ -384,6 +384,10 @@
     attribute = package->xmlChildrenNode;
     while ( attribute != NULL ) {
         attrname = xmlGetProp(attribute, "name");
+        if( attrname == NULL ) {
+            attribute = attribute->next;
+            continue;
+        }
         if ( ! strcmp("name", attrname) ) {
             parse_dia_string(attribute->xmlChildrenNode, myself->name);
         } else if ( ! strcmp ( "obj_pos", attrname ) ) {
@@ -418,6 +422,10 @@
     attribute = class->xmlChildrenNode;
     while ( attribute != NULL ) {
         attrname = xmlGetProp(attribute, "name");
+        if( attrname == NULL ) {
+            attribute = attribute->next;
+            continue;
+        }
         if ( ! strcmp("name", attrname) ) {
             parse_dia_string(attribute->xmlChildrenNode, myself->name);
         } else if ( ! strcmp ( "obj_pos", attrname ) ) {
@@ -478,7 +486,7 @@
             id = xmlGetProp(attribute->xmlChildrenNode, "to");
         } else {
             attrname = xmlGetProp(attribute, "name");
-            if ( ! strcmp("text", attrname) && attribute->xmlChildrenNode != NULL &&
+            if ( attrname != NULL && ! strcmp("text", attrname) && attribute->xmlChildrenNode != NULL &&
                     attribute->xmlChildrenNode->xmlChildrenNode != NULL ){
                 name = attribute->xmlChildrenNode->xmlChildrenNode->content;
             } else {