|
|
d35507 |
diff -up cups-filters-1.0.35/filter/textcommon.c.CVE-2015-3258-3279 cups-filters-1.0.35/filter/textcommon.c
|
|
|
d35507 |
--- cups-filters-1.0.35/filter/textcommon.c.CVE-2015-3258-3279 2013-05-07 19:24:58.000000000 +0100
|
|
|
d35507 |
+++ cups-filters-1.0.35/filter/textcommon.c 2015-07-09 08:16:32.506423028 +0100
|
|
|
d35507 |
@@ -26,6 +26,7 @@
|
|
|
d35507 |
*/
|
|
|
d35507 |
|
|
|
d35507 |
#include "textcommon.h"
|
|
|
d35507 |
+#include <limits.h>
|
|
|
d35507 |
|
|
|
d35507 |
|
|
|
d35507 |
/*
|
|
|
d35507 |
@@ -644,6 +645,45 @@ TextMain(const char *name, /* I - Name o
|
|
|
d35507 |
if (PrettyPrint)
|
|
|
d35507 |
PageTop -= 216.0f / LinesPerInch;
|
|
|
d35507 |
|
|
|
d35507 |
+ /*
|
|
|
d35507 |
+ * Allocate memory for the page...
|
|
|
d35507 |
+ */
|
|
|
d35507 |
+
|
|
|
d35507 |
+ SizeColumns = (PageRight - PageLeft) / 72.0 * CharsPerInch;
|
|
|
d35507 |
+ SizeLines = (PageTop - PageBottom) / 72.0 * LinesPerInch;
|
|
|
d35507 |
+
|
|
|
d35507 |
+ /*
|
|
|
d35507 |
+ * Enforce minimum size...
|
|
|
d35507 |
+ */
|
|
|
d35507 |
+ if (SizeColumns < 1)
|
|
|
d35507 |
+ SizeColumns = 1;
|
|
|
d35507 |
+ if (SizeLines < 1)
|
|
|
d35507 |
+ SizeLines = 1;
|
|
|
d35507 |
+
|
|
|
d35507 |
+ if (SizeLines >= INT_MAX / SizeColumns / sizeof(lchar_t))
|
|
|
d35507 |
+ {
|
|
|
d35507 |
+ fprintf(stderr, "ERROR: bad page size\n");
|
|
|
d35507 |
+ exit(1);
|
|
|
d35507 |
+ }
|
|
|
d35507 |
+
|
|
|
d35507 |
+ Page = calloc(sizeof(lchar_t *), SizeLines);
|
|
|
d35507 |
+ if (!Page)
|
|
|
d35507 |
+ {
|
|
|
d35507 |
+ fprintf(stderr, "ERROR: cannot allocate memory for page\n");
|
|
|
d35507 |
+ exit(1);
|
|
|
d35507 |
+ }
|
|
|
d35507 |
+
|
|
|
d35507 |
+ Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines);
|
|
|
d35507 |
+ if (!Page[0])
|
|
|
d35507 |
+ {
|
|
|
d35507 |
+ free(Page);
|
|
|
d35507 |
+ fprintf(stderr, "ERROR: cannot allocate memory for page\n");
|
|
|
d35507 |
+ exit(1);
|
|
|
d35507 |
+ }
|
|
|
d35507 |
+
|
|
|
d35507 |
+ for (i = 1; i < SizeLines; i ++)
|
|
|
d35507 |
+ Page[i] = Page[0] + i * SizeColumns;
|
|
|
d35507 |
+
|
|
|
d35507 |
Copies = atoi(argv[4]);
|
|
|
d35507 |
|
|
|
d35507 |
WriteProlog(argv[3], argv[2], getenv("CLASSIFICATION"),
|
|
|
d35507 |
@@ -1122,6 +1162,8 @@ TextMain(const char *name, /* I - Name o
|
|
|
d35507 |
if (ppd != NULL)
|
|
|
d35507 |
ppdClose(ppd);
|
|
|
d35507 |
|
|
|
d35507 |
+ free(Page[0]);
|
|
|
d35507 |
+ free(Page);
|
|
|
d35507 |
return (0);
|
|
|
d35507 |
}
|
|
|
d35507 |
|
|
|
d35507 |
diff -up cups-filters-1.0.35/filter/texttopdf.c.CVE-2015-3258-3279 cups-filters-1.0.35/filter/texttopdf.c
|
|
|
d35507 |
--- cups-filters-1.0.35/filter/texttopdf.c.CVE-2015-3258-3279 2015-07-09 08:16:12.266663237 +0100
|
|
|
d35507 |
+++ cups-filters-1.0.35/filter/texttopdf.c 2015-07-09 08:16:32.506423028 +0100
|
|
|
d35507 |
@@ -172,9 +172,6 @@ WriteEpilogue(void)
|
|
|
d35507 |
{ "FN","FB","FI" };
|
|
|
d35507 |
int i,j;
|
|
|
d35507 |
|
|
|
d35507 |
- free(Page[0]);
|
|
|
d35507 |
- free(Page);
|
|
|
d35507 |
-
|
|
|
d35507 |
// embed fonts
|
|
|
d35507 |
for (i = PrettyPrint ? 2 : 1; i >= 0; i --) {
|
|
|
d35507 |
for (j = 0; j < NumFonts; j ++)
|
|
|
d35507 |
@@ -333,18 +330,6 @@ WriteProlog(const char *title, /* I - T
|
|
|
d35507 |
PageTop -= 36;
|
|
|
d35507 |
}
|
|
|
d35507 |
|
|
|
d35507 |
- /*
|
|
|
d35507 |
- * Allocate memory for the page...
|
|
|
d35507 |
- */
|
|
|
d35507 |
-
|
|
|
d35507 |
- SizeColumns = (PageRight - PageLeft) / 72.0 * CharsPerInch;
|
|
|
d35507 |
- SizeLines = (PageTop - PageBottom) / 72.0 * LinesPerInch;
|
|
|
d35507 |
-
|
|
|
d35507 |
- Page = calloc(sizeof(lchar_t *), SizeLines);
|
|
|
d35507 |
- Page[0] = calloc(sizeof(lchar_t), SizeColumns * SizeLines);
|
|
|
d35507 |
- for (i = 1; i < SizeLines; i ++)
|
|
|
d35507 |
- Page[i] = Page[0] + i * SizeColumns;
|
|
|
d35507 |
-
|
|
|
d35507 |
if (PageColumns > 1)
|
|
|
d35507 |
{
|
|
|
d35507 |
ColumnGutter = CharsPerInch / 2;
|