]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/texttops.c
Merge CUPS 1.4svn-r8052 (tentative 1.4b1)
[thirdparty/cups.git] / filter / texttops.c
index 59460ce7a6618545253dcf258e7e4b6a0e5d4692..29f5b15c62aac7a42d8a700af224c2e144088f12 100644 (file)
@@ -173,6 +173,14 @@ WriteProlog(const char *title,             /* I - Title of job */
   SizeColumns = (PageRight - PageLeft) / 72.0 * CharsPerInch;
   SizeLines   = (PageTop - PageBottom) / 72.0 * LinesPerInch;
 
+  if (SizeColumns <= 0 || SizeColumns > 32767 ||
+      SizeLines <= 0 || SizeLines > 32767)
+  {
+    _cupsLangPrintf(stderr, _("ERROR: Unable to print %dx%d text page!\n"),
+                    SizeColumns, SizeLines);
+    exit(1);
+  }
+
   Page    = calloc(sizeof(lchar_t *), SizeLines);
   Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines);
   for (i = 1; i < SizeLines; i ++)
@@ -187,6 +195,13 @@ WriteProlog(const char *title,             /* I - Title of job */
   else
     ColumnWidth = SizeColumns;
 
+  if (ColumnWidth <= 0)
+  {
+    _cupsLangPrintf(stderr, _("ERROR: Unable to print %d text columns!\n"),
+                    PageColumns);
+    exit(1);
+  }
+
  /*
   * Output the DSC header...
   */