[Kst] [Bug 111571] dirfile data source poorly handles errorconditions.

Andrew Walker arwalker at sumusltd.com
Wed Oct 12 00:13:20 CEST 2005


I'm not sure that changing exit to abort really addresses this bug. As I
read it
the point was to ensure that the data source doesn't simply die as the
result of
some format error, which could be very annoying for the user. At worst the
data
source should simply return an error code or refuse to read any data. At
best
the user would receive some meaningful error message that would allow them
to
correct the problem.

-----Original Message-----
From: George Staikos [mailto:staikos at kde.org]
Sent: Tuesday, October 11, 2005 2:17 PM
To: kst at kde.org
Subject: [Kst] [Bug 111571] dirfile data source poorly handles
errorconditions.


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

http://bugs.kde.org/show_bug.cgi?id=111571
staikos kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From staikos kde org  2005-10-11 23:17 -------
SVN commit 469654 by staikos:

remove the exit(0) and replace with abort() or a runtime check as
appropriate
BUG: 111571


 M  +11 -6     getdata.c


--- trunk/extragear/graphics/kst/kst/datasources/dirfile/getdata.c
#469653:469654
 @ -956,12 +956,11  @
       break;
     default:
       printf("Unexpected bad type error in AllocTmpbuff (%c)\n",type);
-      exit(0);
+      abort();
       break;
   }
   if ((type != 'n') && (buff==NULL)) {
     printf("Memory Allocation error in AllocTmpbuff\n");
-    exit(0);
   }
   return(buff);
 }
 @ -1029,7 +1028,7  @
       break;
     default:
       printf("Another impossible error\n");
-      exit(0);
+      abort();
       break;
   }
 }
 @ -1082,7 +1081,7  @
       break;
     default:
       printf("Unexpected bad type error in AddData\n");
-      exit(0);
+      abort();
       break;
   }
 }
 @ -1136,7 +1135,7  @
       break;
     default:
       printf("Unexpected bad type error in MultiplyData\n");
-      exit(0);
+      abort();
       break;
   }
 }
 @ -1192,6 +1191,9  @
       if (*error_code != GD_E_OK) return(1);

       tmpbuf = AllocTmpbuff(return_type, *n_read * (int)ceil((double)spf2 /
spf1));
+      if (!tmpbuf && return_type != 'n') {
+        return(0);
+      }

       num_samp = (*n_read * spf2 / spf1) % spf2;

 @ -1261,6 +1263,9  @
   if (*error_code != GD_E_OK) return(1);

   tmpbuf = AllocTmpbuff(return_type, *n_read * (int)ceil((double)spf2 /
spf1));
+  if (!tmpbuf && return_type != 'n') {
+    return(0);
+  }

   n_read2 = DoField(F, M->in_fields[1],
       first_frame, first_samp,
 @ -1469,7 +1474,7  @
         break;
       default:
         printf("Another impossible error\n");
-        exit(0);
+        abort();
         break;
     }
   }
_______________________________________________
Kst mailing list
Kst at kde.org
https://mail.kde.org/mailman/listinfo/kst



More information about the Kst mailing list