[Kst] [Bug 111571] dirfile data source poorly handles error conditions.

George Staikos staikos at kde.org
Tue Oct 11 23:17:12 CEST 2005


------- 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;
     }
   }


More information about the Kst mailing list