]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: No exit() in mupdftoraster() and rastertopwg()
authorTill Kamppeter <till.kamppeter@gmail.com>
Fri, 19 Nov 2021 22:39:48 +0000 (23:39 +0100)
committerTill Kamppeter <till.kamppeter@gmail.com>
Fri, 19 Nov 2021 22:39:48 +0000 (23:39 +0100)
An error in a single filter function should not kill the whole Printer
Application.

cupsfilters/mupdftoraster.c
cupsfilters/rastertopwg.c

index 5e759bd01e9aa8d5650327da4b7a946c745329e4..a6504674cf48797846af2722ef0026c4f08bc6af 100644 (file)
@@ -80,7 +80,7 @@ parse_doc_type(FILE *fp, filter_logfunc_t log, void *ld)
     return 0;
 
   if(log) log(ld, FILTER_LOGLEVEL_DEBUG, "mupdftoraster: input file cannot be identified");
-  exit(EXIT_FAILURE);
+  return -1;
 }
 
 static void
@@ -339,8 +339,9 @@ mupdftoraster (int inputfd,         /* I - File descriptor input stream */
 
 
   /* If doc type is not PDF exit */
-  if(parse_doc_type(fp, log, ld))
-     empty = 1;
+  empty = parse_doc_type(fp, log, ld);
+  if (empty == -1)
+    goto out;
 
   /*  Check status of color management in CUPS */
   cm_calibrate = cmGetCupsColorCalibrateMode(data, options, num_options);
index 912a7c2c6b4fd569c1263b9895d4866bfd0a72a4..8d93a70315516b7ab009e67da09a1998298f36c9 100644 (file)
@@ -62,8 +62,6 @@ rastertopwg(int inputfd,         /* I - File descriptor input stream */
   filter_out_format_t output_format;
 
 
-  inras  = cupsRasterOpen(inputfd, CUPS_RASTER_READ);
-
   if (parameters)
   {
     output_format = *(filter_out_format_t *)parameters;
@@ -74,10 +72,12 @@ rastertopwg(int inputfd,         /* I - File descriptor input stream */
   else
   {
     if (log) log(ld, FILTER_LOGLEVEL_ERROR,
-                " rastertopwg: Output format not specified.");
-    exit(1);
+                "rastertopwg: Output format not specified.");
+    return (1);
   }
 
+  inras  = cupsRasterOpen(inputfd, CUPS_RASTER_READ);
+
   if (data->ppd == NULL && data->ppdfile)
     data->ppd = ppdOpenFile(data->ppdfile);