rebase to bugfix release 10.01.2 (rhbz#2182090)
This commit is contained in:
parent
2f987fc842
commit
51fa9cbae6
1
.gitignore
vendored
1
.gitignore
vendored
@ -63,3 +63,4 @@ ghostscript-8.71.tar.xz
|
|||||||
/ghostscript-9.56.1.tar.xz
|
/ghostscript-9.56.1.tar.xz
|
||||||
/ghostscript-10.0.0.tar.xz
|
/ghostscript-10.0.0.tar.xz
|
||||||
/ghostscript-10.01.0.tar.xz
|
/ghostscript-10.01.0.tar.xz
|
||||||
|
/ghostscript-10.01.2.tar.xz
|
||||||
|
@ -1,694 +0,0 @@
|
|||||||
From 387f09416ca7364d09415d47df01864b04cbdbc0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Till Kamppeter <till.kamppeter@gmail.com>
|
|
||||||
Date: Sun, 25 Sep 2022 10:02:28 +0200
|
|
||||||
Subject: [PATCH] CUPS/PWG/Apple Raster output device: Do not match custom size
|
|
||||||
against PPD
|
|
||||||
|
|
||||||
If for a job a custom page size is selected, indicated by something
|
|
||||||
like "-scupsPageSizeName=Custom.4x8in" or "-scupsPageSizeName=Custom",
|
|
||||||
do not try to match the requested page size, given by standard
|
|
||||||
Ghostscript parameters like
|
|
||||||
"-dDEVICEWIDTHPOINTS=... -dDEVICEHEIGHTPOINTS=...", with the supported
|
|
||||||
page sizes defined in the PPD file.
|
|
||||||
|
|
||||||
This avoids unwished rotations as reported in
|
|
||||||
|
|
||||||
https://github.com/OpenPrinting/cups-filters/issues/484
|
|
||||||
|
|
||||||
and also unwished size mismatches if the custom size is very close to
|
|
||||||
a size defined in the PPD file.
|
|
||||||
---
|
|
||||||
cups/gdevcups.c | 538 ++++++++++++++++++++++++------------------------
|
|
||||||
1 file changed, 273 insertions(+), 265 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/cups/gdevcups.c b/cups/gdevcups.c
|
|
||||||
index 6405122ec..cf2ba5e4b 100644
|
|
||||||
--- a/cups/gdevcups.c
|
|
||||||
+++ b/cups/gdevcups.c
|
|
||||||
@@ -3509,28 +3509,6 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
yflip = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
-#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
- /*
|
|
||||||
- * Chack whether cupsPageSizeName has a valid value
|
|
||||||
- */
|
|
||||||
-
|
|
||||||
- if (strlen(cups->header.cupsPageSizeName) != 0) {
|
|
||||||
- found = 0;
|
|
||||||
- for (i = cups->PPD->num_sizes, size = cups->PPD->sizes;
|
|
||||||
- i > 0;
|
|
||||||
- i --, size ++)
|
|
||||||
- if (strcasecmp(cups->header.cupsPageSizeName, size->name) == 0) {
|
|
||||||
- found = 1;
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
- if (found == 0) cups->header.cupsPageSizeName[0] = '\0';
|
|
||||||
- }
|
|
||||||
-#ifdef CUPS_DEBUG
|
|
||||||
- dmprintf1(pdev->memory, "DEBUG2: cups->header.cupsPageSizeName = %s\n",
|
|
||||||
- cups->header.cupsPageSizeName);
|
|
||||||
-#endif /* CUPS_DEBUG */
|
|
||||||
-#endif /* CUPS_RASTER_SYNCv1 */
|
|
||||||
-
|
|
||||||
/*
|
|
||||||
* Find the matching page size...
|
|
||||||
*/
|
|
||||||
@@ -3542,189 +3520,38 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
|
|
||||||
best_score = -1;
|
|
||||||
best_size = NULL;
|
|
||||||
- for (i = cups->PPD->num_sizes, size = cups->PPD->sizes;
|
|
||||||
- i > 0;
|
|
||||||
- i --, size ++)
|
|
||||||
- {
|
|
||||||
- if (size->length == 0 || size->width == 0) continue;
|
|
||||||
-
|
|
||||||
- score = 0;
|
|
||||||
- size_matched = 0;
|
|
||||||
- margins_matched = 0;
|
|
||||||
- imageable_area_matched = 0;
|
|
||||||
-#ifdef CUPS_DEBUG
|
|
||||||
- name_requested_matched = 0;
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
- long_edge_mismatch =
|
|
||||||
- fabs(cups->MediaSize[1] - size->length)/size->length +
|
|
||||||
- LONG_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
- short_edge_mismatch =
|
|
||||||
- fabs(cups->MediaSize[0] - size->width)/size->width +
|
|
||||||
- SHORT_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
- if (size->length < size->width)
|
|
||||||
- {
|
|
||||||
- swap = long_edge_mismatch;
|
|
||||||
- long_edge_mismatch = short_edge_mismatch;
|
|
||||||
- short_edge_mismatch = swap;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (long_edge_mismatch < LONG_EDGE_LENGTH_MATCH_LIMIT &&
|
|
||||||
- short_edge_mismatch < SHORT_EDGE_LENGTH_MATCH_LIMIT)
|
|
||||||
- {
|
|
||||||
- size_matched = 1;
|
|
||||||
- /* If two sizes match within the limits, take the one with less
|
|
||||||
- mismatch */
|
|
||||||
- score = (long)(9999.0 -
|
|
||||||
- long_edge_mismatch * short_edge_mismatch * 9999.0 /
|
|
||||||
- LONG_EDGE_LENGTH_MATCH_LIMIT /
|
|
||||||
- SHORT_EDGE_LENGTH_MATCH_LIMIT);
|
|
||||||
- if (score < 0) score = 0;
|
|
||||||
- /* We check whether all 4 margins match with the margin info
|
|
||||||
- of the page size in the PPD. Here we check also for swapped
|
|
||||||
- left/right and top/bottom margins as the cups->HWMargins
|
|
||||||
- info can be from the previous page and there the margins
|
|
||||||
- can be swapped due to duplex printing requirements */
|
|
||||||
- if (!margins_set ||
|
|
||||||
- (((fabs(cups->HWMargins[0] - size->left) < 1.0 &&
|
|
||||||
- fabs(cups->HWMargins[2] - size->width + size->right) < 1.0) ||
|
|
||||||
- (fabs(cups->HWMargins[0] - size->width + size->right) < 1.0 &&
|
|
||||||
- fabs(cups->HWMargins[2] - size->left) < 1.0)) &&
|
|
||||||
- ((fabs(cups->HWMargins[1] - size->bottom) < 1.0 &&
|
|
||||||
- fabs(cups->HWMargins[3] - size->length + size->top) < 1.0) ||
|
|
||||||
- (fabs(cups->HWMargins[1] - size->length + size->top) < 1.0 &&
|
|
||||||
- fabs(cups->HWMargins[3] - size->bottom) < 1.0))))
|
|
||||||
- margins_matched = 1;
|
|
||||||
- } else {
|
|
||||||
- /* Compare the dimensions of the imageable area against the
|
|
||||||
- the input page size */
|
|
||||||
- long_edge_mismatch =
|
|
||||||
- fabs(cups->MediaSize[1] - size->top + size->bottom)/size->length +
|
|
||||||
- LONG_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
- short_edge_mismatch =
|
|
||||||
- fabs(cups->MediaSize[0] - size->right + size->left)/size->width +
|
|
||||||
- SHORT_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
- if (size->length < size->width)
|
|
||||||
- {
|
|
||||||
- swap = long_edge_mismatch;
|
|
||||||
- long_edge_mismatch = short_edge_mismatch;
|
|
||||||
- short_edge_mismatch = swap;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (long_edge_mismatch < LONG_EDGE_LENGTH_MATCH_LIMIT &&
|
|
||||||
- short_edge_mismatch < SHORT_EDGE_LENGTH_MATCH_LIMIT)
|
|
||||||
- {
|
|
||||||
- imageable_area_matched = 1;
|
|
||||||
- /* If two sizes match within the limits, take the one with less
|
|
||||||
- mismatch */
|
|
||||||
- score = (long)(4999.0 -
|
|
||||||
- long_edge_mismatch * short_edge_mismatch * 4999.0 /
|
|
||||||
- LONG_EDGE_LENGTH_MATCH_LIMIT /
|
|
||||||
- SHORT_EDGE_LENGTH_MATCH_LIMIT);
|
|
||||||
- if (score < 0) score = 0;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (margins_matched)
|
|
||||||
- score += PAGESIZE_SCORE_SIZE_MARGINS * 10000;
|
|
||||||
- else if (size_matched)
|
|
||||||
- score += PAGESIZE_SCORE_SIZE * 10000;
|
|
||||||
-
|
|
||||||
- if (size_matched || imageable_area_matched) {
|
|
||||||
- if (!strcasecmp(cups->pageSizeRequested, size->name))
|
|
||||||
- {
|
|
||||||
-#ifdef CUPS_DEBUG
|
|
||||||
- name_requested_matched = 1;
|
|
||||||
-#endif
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- score -= 1000;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (score > best_score)
|
|
||||||
- {
|
|
||||||
- best_score = score;
|
|
||||||
- if (score > 0)
|
|
||||||
- best_size = size;
|
|
||||||
- }
|
|
||||||
-#ifdef CUPS_DEBUG
|
|
||||||
- dmprintf1(pdev->memory, "DEBUG2: Checking against PPD page size (portrait): %s\n",
|
|
||||||
- size->name);
|
|
||||||
- dmprintf2(pdev->memory, "DEBUG2: Width: %.2f; Height: %.2f\n",
|
|
||||||
- size->width, size->length);
|
|
||||||
- dmprintf4(pdev->memory, "DEBUG2: Margins: Left: %.2f; Right: %.2f; Top: %.2f; Bottom: %.2f\n",
|
|
||||||
- size->left, size->right, size->top, size->bottom);
|
|
||||||
- dmprintf4(pdev->memory, "DEBUG2: Size mismatch: Long Edge (%.3f): %.5f; Short Edge (%.3f): %.5f\n",
|
|
||||||
- LONG_EDGE_LENGTH_MATCH_LIMIT, long_edge_mismatch,
|
|
||||||
- SHORT_EDGE_LENGTH_MATCH_LIMIT, short_edge_mismatch);
|
|
||||||
- dmprintf4(pdev->memory, "DEBUG2: Match: Size: %d; Margins: %d; Imageable Area: %d; Name requested: %d\n",
|
|
||||||
- size_matched, margins_matched, imageable_area_matched,
|
|
||||||
- name_requested_matched);
|
|
||||||
- dmprintf2(pdev->memory, "DEBUG2: Score: %ld; Best Score: %ld\n",
|
|
||||||
- score, best_score);
|
|
||||||
-#endif /* CUPS_DEBUG */
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (best_size)
|
|
||||||
+ /* Match against the PPD's page size only if the page size name does
|
|
||||||
+ not suggest that we use a custom page size */
|
|
||||||
+ if (strncasecmp(cups->header.cupsPageSizeName, "Custom", 6) != 0 ||
|
|
||||||
+ (cups->header.cupsPageSizeName[6] != '\0' &&
|
|
||||||
+ cups->header.cupsPageSizeName[6] != '.'))
|
|
||||||
{
|
|
||||||
+#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
/*
|
|
||||||
- * Standard size...
|
|
||||||
+ * Chack whether cupsPageSizeName has a valid value
|
|
||||||
*/
|
|
||||||
|
|
||||||
+ if (strlen(cups->header.cupsPageSizeName) != 0) {
|
|
||||||
+ found = 0;
|
|
||||||
+ for (i = cups->PPD->num_sizes, size = cups->PPD->sizes;
|
|
||||||
+ i > 0;
|
|
||||||
+ i --, size ++)
|
|
||||||
+ if (strcasecmp(cups->header.cupsPageSizeName, size->name) == 0) {
|
|
||||||
+ found = 1;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ if (found == 0) cups->header.cupsPageSizeName[0] = '\0';
|
|
||||||
+ }
|
|
||||||
#ifdef CUPS_DEBUG
|
|
||||||
- dmprintf1(pdev->memory, "DEBUG: size = %s\n", best_size->name);
|
|
||||||
+ dmprintf1(pdev->memory, "DEBUG2: cups->header.cupsPageSizeName = %s\n",
|
|
||||||
+ cups->header.cupsPageSizeName);
|
|
||||||
#endif /* CUPS_DEBUG */
|
|
||||||
+#endif /* CUPS_RASTER_SYNCv1 */
|
|
||||||
|
|
||||||
- mediasize[0] = best_size->width;
|
|
||||||
- mediasize[1] = best_size->length;
|
|
||||||
-
|
|
||||||
- cups->landscape = 0;
|
|
||||||
-
|
|
||||||
-#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
- strncpy(cups->header.cupsPageSizeName, best_size->name,
|
|
||||||
- sizeof(cups->header.cupsPageSizeName));
|
|
||||||
- cups->header.cupsPageSizeName[sizeof(cups->header.cupsPageSizeName) - 1] =
|
|
||||||
- '\0';
|
|
||||||
-
|
|
||||||
- if (strcasecmp(cups->header.MediaClass, "PwgRaster") != 0)
|
|
||||||
- {
|
|
||||||
-#endif
|
|
||||||
- margins[0] = best_size->left / 72.0;
|
|
||||||
- margins[1] = best_size->bottom / 72.0;
|
|
||||||
- margins[2] = (best_size->width - best_size->right) / 72.0;
|
|
||||||
- margins[3] = (best_size->length - best_size->top) / 72.0;
|
|
||||||
- if (xflip == 1)
|
|
||||||
- {
|
|
||||||
- swap = margins[0]; margins[0] = margins[2]; margins[2] = swap;
|
|
||||||
- }
|
|
||||||
- if (yflip == 1)
|
|
||||||
- {
|
|
||||||
- swap = margins[1]; margins[1] = margins[3]; margins[3] = swap;
|
|
||||||
- }
|
|
||||||
-#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- margins[0] = 0.0;
|
|
||||||
- margins[1] = 0.0;
|
|
||||||
- margins[2] = 0.0;
|
|
||||||
- margins[3] = 0.0;
|
|
||||||
- }
|
|
||||||
-#endif
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- /*
|
|
||||||
- * No matching portrait size; look for a matching size in
|
|
||||||
- * landscape orientation...
|
|
||||||
- */
|
|
||||||
-
|
|
||||||
- best_score = -1;
|
|
||||||
- best_size = NULL;
|
|
||||||
for (i = cups->PPD->num_sizes, size = cups->PPD->sizes;
|
|
||||||
i > 0;
|
|
||||||
i --, size ++)
|
|
||||||
- {
|
|
||||||
+ {
|
|
||||||
if (size->length == 0 || size->width == 0) continue;
|
|
||||||
|
|
||||||
score = 0;
|
|
||||||
@@ -3736,10 +3563,10 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
long_edge_mismatch =
|
|
||||||
- fabs(cups->MediaSize[0] - size->length)/size->length +
|
|
||||||
+ fabs(cups->MediaSize[1] - size->length)/size->length +
|
|
||||||
LONG_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
short_edge_mismatch =
|
|
||||||
- fabs(cups->MediaSize[1] - size->width)/size->width +
|
|
||||||
+ fabs(cups->MediaSize[0] - size->width)/size->width +
|
|
||||||
SHORT_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
if (size->length < size->width)
|
|
||||||
{
|
|
||||||
@@ -3765,23 +3592,23 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
info can be from the previous page and there the margins
|
|
||||||
can be swapped due to duplex printing requirements */
|
|
||||||
if (!margins_set ||
|
|
||||||
- (((fabs(cups->HWMargins[1] - size->left) < 1.0 &&
|
|
||||||
- fabs(cups->HWMargins[3] - size->width + size->right) < 1.0)||
|
|
||||||
- (fabs(cups->HWMargins[1] - size->width + size->right) < 1.0 &&
|
|
||||||
- fabs(cups->HWMargins[3] - size->left) < 1.0)) &&
|
|
||||||
- ((fabs(cups->HWMargins[0] - size->bottom) < 1.0 &&
|
|
||||||
- fabs(cups->HWMargins[2] - size->length + size->top) < 1.0) ||
|
|
||||||
- (fabs(cups->HWMargins[0] - size->length + size->top) < 1.0 &&
|
|
||||||
- fabs(cups->HWMargins[2] - size->bottom) < 1.0))))
|
|
||||||
+ (((fabs(cups->HWMargins[0] - size->left) < 1.0 &&
|
|
||||||
+ fabs(cups->HWMargins[2] - size->width + size->right) < 1.0) ||
|
|
||||||
+ (fabs(cups->HWMargins[0] - size->width + size->right) < 1.0 &&
|
|
||||||
+ fabs(cups->HWMargins[2] - size->left) < 1.0)) &&
|
|
||||||
+ ((fabs(cups->HWMargins[1] - size->bottom) < 1.0 &&
|
|
||||||
+ fabs(cups->HWMargins[3] - size->length + size->top) < 1.0) ||
|
|
||||||
+ (fabs(cups->HWMargins[1] - size->length + size->top) < 1.0 &&
|
|
||||||
+ fabs(cups->HWMargins[3] - size->bottom) < 1.0))))
|
|
||||||
margins_matched = 1;
|
|
||||||
} else {
|
|
||||||
/* Compare the dimensions of the imageable area against the
|
|
||||||
the input page size */
|
|
||||||
long_edge_mismatch =
|
|
||||||
- fabs(cups->MediaSize[0] - size->top + size->bottom)/size->length +
|
|
||||||
+ fabs(cups->MediaSize[1] - size->top + size->bottom)/size->length +
|
|
||||||
LONG_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
short_edge_mismatch =
|
|
||||||
- fabs(cups->MediaSize[1] - size->right + size->left)/size->width +
|
|
||||||
+ fabs(cups->MediaSize[0] - size->right + size->left)/size->width +
|
|
||||||
SHORT_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
if (size->length < size->width)
|
|
||||||
{
|
|
||||||
@@ -3811,11 +3638,11 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
|
|
||||||
if (size_matched || imageable_area_matched) {
|
|
||||||
if (!strcasecmp(cups->pageSizeRequested, size->name))
|
|
||||||
- {
|
|
||||||
+ {
|
|
||||||
#ifdef CUPS_DEBUG
|
|
||||||
name_requested_matched = 1;
|
|
||||||
#endif
|
|
||||||
- }
|
|
||||||
+ }
|
|
||||||
else
|
|
||||||
score -= 1000;
|
|
||||||
}
|
|
||||||
@@ -3827,7 +3654,7 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
best_size = size;
|
|
||||||
}
|
|
||||||
#ifdef CUPS_DEBUG
|
|
||||||
- dmprintf1(pdev->memory, "DEBUG2: Checking against PPD page size (landscape): %s\n",
|
|
||||||
+ dmprintf1(pdev->memory, "DEBUG2: Checking against PPD page size (portrait): %s\n",
|
|
||||||
size->name);
|
|
||||||
dmprintf2(pdev->memory, "DEBUG2: Width: %.2f; Height: %.2f\n",
|
|
||||||
size->width, size->length);
|
|
||||||
@@ -3847,17 +3674,17 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
if (best_size)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
- * Standard size in landscape orientation...
|
|
||||||
+ * Standard size...
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef CUPS_DEBUG
|
|
||||||
- dmprintf1(pdev->memory, "DEBUG: landscape size = %s\n", best_size->name);
|
|
||||||
+ dmprintf1(pdev->memory, "DEBUG: size = %s\n", best_size->name);
|
|
||||||
#endif /* CUPS_DEBUG */
|
|
||||||
|
|
||||||
- mediasize[0] = best_size->length;
|
|
||||||
- mediasize[1] = best_size->width;
|
|
||||||
+ mediasize[0] = best_size->width;
|
|
||||||
+ mediasize[1] = best_size->length;
|
|
||||||
|
|
||||||
- cups->landscape = 1;
|
|
||||||
+ cups->landscape = 0;
|
|
||||||
|
|
||||||
#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
strncpy(cups->header.cupsPageSizeName, best_size->name,
|
|
||||||
@@ -3868,17 +3695,17 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
if (strcasecmp(cups->header.MediaClass, "PwgRaster") != 0)
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
- margins[0] = (best_size->length - best_size->top) / 72.0;
|
|
||||||
- margins[1] = best_size->left / 72.0;
|
|
||||||
- margins[2] = best_size->bottom / 72.0;
|
|
||||||
- margins[3] = (best_size->width - best_size->right) / 72.0;
|
|
||||||
+ margins[0] = best_size->left / 72.0;
|
|
||||||
+ margins[1] = best_size->bottom / 72.0;
|
|
||||||
+ margins[2] = (best_size->width - best_size->right) / 72.0;
|
|
||||||
+ margins[3] = (best_size->length - best_size->top) / 72.0;
|
|
||||||
if (xflip == 1)
|
|
||||||
{
|
|
||||||
- swap = margins[1]; margins[1] = margins[3]; margins[3] = swap;
|
|
||||||
+ swap = margins[0]; margins[0] = margins[2]; margins[2] = swap;
|
|
||||||
}
|
|
||||||
if (yflip == 1)
|
|
||||||
{
|
|
||||||
- swap = margins[0]; margins[0] = margins[2]; margins[2] = swap;
|
|
||||||
+ swap = margins[1]; margins[1] = margins[3]; margins[3] = swap;
|
|
||||||
}
|
|
||||||
#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
}
|
|
||||||
@@ -3894,40 +3721,163 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
- * Custom size...
|
|
||||||
+ * No matching portrait size; look for a matching size in
|
|
||||||
+ * landscape orientation...
|
|
||||||
*/
|
|
||||||
|
|
||||||
+ best_score = -1;
|
|
||||||
+ best_size = NULL;
|
|
||||||
+ for (i = cups->PPD->num_sizes, size = cups->PPD->sizes;
|
|
||||||
+ i > 0;
|
|
||||||
+ i --, size ++)
|
|
||||||
+ {
|
|
||||||
+ if (size->length == 0 || size->width == 0) continue;
|
|
||||||
+
|
|
||||||
+ score = 0;
|
|
||||||
+ size_matched = 0;
|
|
||||||
+ margins_matched = 0;
|
|
||||||
+ imageable_area_matched = 0;
|
|
||||||
#ifdef CUPS_DEBUG
|
|
||||||
- dmprintf(pdev->memory, "DEBUG: size = Custom\n");
|
|
||||||
-#endif /* CUPS_DEBUG */
|
|
||||||
+ name_requested_matched = 0;
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
-#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
- snprintf(cups->header.cupsPageSizeName,
|
|
||||||
- sizeof(cups->header.cupsPageSizeName),
|
|
||||||
- "Custom.%.2fx%.2f",
|
|
||||||
- cups->MediaSize[0], cups->MediaSize[1]);
|
|
||||||
+ long_edge_mismatch =
|
|
||||||
+ fabs(cups->MediaSize[0] - size->length)/size->length +
|
|
||||||
+ LONG_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
+ short_edge_mismatch =
|
|
||||||
+ fabs(cups->MediaSize[1] - size->width)/size->width +
|
|
||||||
+ SHORT_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
+ if (size->length < size->width)
|
|
||||||
+ {
|
|
||||||
+ swap = long_edge_mismatch;
|
|
||||||
+ long_edge_mismatch = short_edge_mismatch;
|
|
||||||
+ short_edge_mismatch = swap;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (long_edge_mismatch < LONG_EDGE_LENGTH_MATCH_LIMIT &&
|
|
||||||
+ short_edge_mismatch < SHORT_EDGE_LENGTH_MATCH_LIMIT)
|
|
||||||
+ {
|
|
||||||
+ size_matched = 1;
|
|
||||||
+ /* If two sizes match within the limits, take the one with less
|
|
||||||
+ mismatch */
|
|
||||||
+ score = (long)(9999.0 -
|
|
||||||
+ long_edge_mismatch * short_edge_mismatch * 9999.0 /
|
|
||||||
+ LONG_EDGE_LENGTH_MATCH_LIMIT /
|
|
||||||
+ SHORT_EDGE_LENGTH_MATCH_LIMIT);
|
|
||||||
+ if (score < 0) score = 0;
|
|
||||||
+ /* We check whether all 4 margins match with the margin info
|
|
||||||
+ of the page size in the PPD. Here we check also for swapped
|
|
||||||
+ left/right and top/bottom margins as the cups->HWMargins
|
|
||||||
+ info can be from the previous page and there the margins
|
|
||||||
+ can be swapped due to duplex printing requirements */
|
|
||||||
+ if (!margins_set ||
|
|
||||||
+ (((fabs(cups->HWMargins[1] - size->left) < 1.0 &&
|
|
||||||
+ fabs(cups->HWMargins[3] - size->width + size->right) < 1.0)||
|
|
||||||
+ (fabs(cups->HWMargins[1] - size->width + size->right) < 1.0 &&
|
|
||||||
+ fabs(cups->HWMargins[3] - size->left) < 1.0)) &&
|
|
||||||
+ ((fabs(cups->HWMargins[0] - size->bottom) < 1.0 &&
|
|
||||||
+ fabs(cups->HWMargins[2] - size->length + size->top) < 1.0) ||
|
|
||||||
+ (fabs(cups->HWMargins[0] - size->length + size->top) < 1.0 &&
|
|
||||||
+ fabs(cups->HWMargins[2] - size->bottom) < 1.0))))
|
|
||||||
+ margins_matched = 1;
|
|
||||||
+ } else {
|
|
||||||
+ /* Compare the dimensions of the imageable area against the
|
|
||||||
+ the input page size */
|
|
||||||
+ long_edge_mismatch =
|
|
||||||
+ fabs(cups->MediaSize[0] - size->top + size->bottom)/size->length +
|
|
||||||
+ LONG_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
+ short_edge_mismatch =
|
|
||||||
+ fabs(cups->MediaSize[1] - size->right + size->left)/size->width +
|
|
||||||
+ SHORT_EDGE_LENGTH_MATCH_LIMIT / 100;
|
|
||||||
+ if (size->length < size->width)
|
|
||||||
+ {
|
|
||||||
+ swap = long_edge_mismatch;
|
|
||||||
+ long_edge_mismatch = short_edge_mismatch;
|
|
||||||
+ short_edge_mismatch = swap;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (long_edge_mismatch < LONG_EDGE_LENGTH_MATCH_LIMIT &&
|
|
||||||
+ short_edge_mismatch < SHORT_EDGE_LENGTH_MATCH_LIMIT)
|
|
||||||
+ {
|
|
||||||
+ imageable_area_matched = 1;
|
|
||||||
+ /* If two sizes match within the limits, take the one with less
|
|
||||||
+ mismatch */
|
|
||||||
+ score = (long)(4999.0 -
|
|
||||||
+ long_edge_mismatch * short_edge_mismatch * 4999.0 /
|
|
||||||
+ LONG_EDGE_LENGTH_MATCH_LIMIT /
|
|
||||||
+ SHORT_EDGE_LENGTH_MATCH_LIMIT);
|
|
||||||
+ if (score < 0) score = 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (margins_matched)
|
|
||||||
+ score += PAGESIZE_SCORE_SIZE_MARGINS * 10000;
|
|
||||||
+ else if (size_matched)
|
|
||||||
+ score += PAGESIZE_SCORE_SIZE * 10000;
|
|
||||||
+
|
|
||||||
+ if (size_matched || imageable_area_matched) {
|
|
||||||
+ if (!strcasecmp(cups->pageSizeRequested, size->name))
|
|
||||||
+ {
|
|
||||||
+#ifdef CUPS_DEBUG
|
|
||||||
+ name_requested_matched = 1;
|
|
||||||
#endif
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ score -= 1000;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (score > best_score)
|
|
||||||
+ {
|
|
||||||
+ best_score = score;
|
|
||||||
+ if (score > 0)
|
|
||||||
+ best_size = size;
|
|
||||||
+ }
|
|
||||||
+#ifdef CUPS_DEBUG
|
|
||||||
+ dmprintf1(pdev->memory, "DEBUG2: Checking against PPD page size (landscape): %s\n",
|
|
||||||
+ size->name);
|
|
||||||
+ dmprintf2(pdev->memory, "DEBUG2: Width: %.2f; Height: %.2f\n",
|
|
||||||
+ size->width, size->length);
|
|
||||||
+ dmprintf4(pdev->memory, "DEBUG2: Margins: Left: %.2f; Right: %.2f; Top: %.2f; Bottom: %.2f\n",
|
|
||||||
+ size->left, size->right, size->top, size->bottom);
|
|
||||||
+ dmprintf4(pdev->memory, "DEBUG2: Size mismatch: Long Edge (%.3f): %.5f; Short Edge (%.3f): %.5f\n",
|
|
||||||
+ LONG_EDGE_LENGTH_MATCH_LIMIT, long_edge_mismatch,
|
|
||||||
+ SHORT_EDGE_LENGTH_MATCH_LIMIT, short_edge_mismatch);
|
|
||||||
+ dmprintf4(pdev->memory, "DEBUG2: Match: Size: %d; Margins: %d; Imageable Area: %d; Name requested: %d\n",
|
|
||||||
+ size_matched, margins_matched, imageable_area_matched,
|
|
||||||
+ name_requested_matched);
|
|
||||||
+ dmprintf2(pdev->memory, "DEBUG2: Score: %ld; Best Score: %ld\n",
|
|
||||||
+ score, best_score);
|
|
||||||
+#endif /* CUPS_DEBUG */
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (best_size)
|
|
||||||
+ {
|
|
||||||
+ /*
|
|
||||||
+ * Standard size in landscape orientation...
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#ifdef CUPS_DEBUG
|
|
||||||
+ dmprintf1(pdev->memory, "DEBUG: landscape size = %s\n", best_size->name);
|
|
||||||
+#endif /* CUPS_DEBUG */
|
|
||||||
|
|
||||||
- /* Rotate page if it only fits into the printer's dimensions
|
|
||||||
- when rotated */
|
|
||||||
- if (((cups->MediaSize[0] > cups->PPD->custom_max[0]) ||
|
|
||||||
- (cups->MediaSize[1] > cups->PPD->custom_max[1])) &&
|
|
||||||
- ((cups->MediaSize[0] <= cups->PPD->custom_max[1]) &&
|
|
||||||
- (cups->MediaSize[1] <= cups->PPD->custom_max[0]))) {
|
|
||||||
- /* Rotate */
|
|
||||||
- mediasize[0] = cups->MediaSize[1];
|
|
||||||
- mediasize[1] = cups->MediaSize[0];
|
|
||||||
+ mediasize[0] = best_size->length;
|
|
||||||
+ mediasize[1] = best_size->width;
|
|
||||||
|
|
||||||
cups->landscape = 1;
|
|
||||||
|
|
||||||
#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
+ strncpy(cups->header.cupsPageSizeName, best_size->name,
|
|
||||||
+ sizeof(cups->header.cupsPageSizeName));
|
|
||||||
+ cups->header.cupsPageSizeName[sizeof(cups->header.cupsPageSizeName) - 1] =
|
|
||||||
+ '\0';
|
|
||||||
+
|
|
||||||
if (strcasecmp(cups->header.MediaClass, "PwgRaster") != 0)
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
- margins[0] = cups->PPD->custom_margins[3] / 72.0;
|
|
||||||
- margins[1] = cups->PPD->custom_margins[0] / 72.0;
|
|
||||||
- margins[2] = cups->PPD->custom_margins[1] / 72.0;
|
|
||||||
- margins[3] = cups->PPD->custom_margins[2] / 72.0;
|
|
||||||
+ margins[0] = (best_size->length - best_size->top) / 72.0;
|
|
||||||
+ margins[1] = best_size->left / 72.0;
|
|
||||||
+ margins[2] = best_size->bottom / 72.0;
|
|
||||||
+ margins[3] = (best_size->width - best_size->right) / 72.0;
|
|
||||||
if (xflip == 1)
|
|
||||||
{
|
|
||||||
swap = margins[1]; margins[1] = margins[3]; margins[3] = swap;
|
|
||||||
@@ -3947,39 +3897,97 @@ cups_put_params(gx_device *pdev, /* I - Device info */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- /* Do not rotate */
|
|
||||||
- mediasize[0] = cups->MediaSize[0];
|
|
||||||
- mediasize[1] = cups->MediaSize[1];
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- cups->landscape = 0;
|
|
||||||
+ if (!best_size)
|
|
||||||
+ {
|
|
||||||
+ /*
|
|
||||||
+ * Custom size...
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#ifdef CUPS_DEBUG
|
|
||||||
+ dmprintf(pdev->memory, "DEBUG: size = Custom\n");
|
|
||||||
+#endif /* CUPS_DEBUG */
|
|
||||||
|
|
||||||
#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
- if (strcasecmp(cups->header.MediaClass, "PwgRaster") != 0)
|
|
||||||
- {
|
|
||||||
+ snprintf(cups->header.cupsPageSizeName,
|
|
||||||
+ sizeof(cups->header.cupsPageSizeName),
|
|
||||||
+ "Custom.%.2fx%.2f",
|
|
||||||
+ cups->MediaSize[0], cups->MediaSize[1]);
|
|
||||||
#endif
|
|
||||||
- for (i = 0; i < 4; i ++)
|
|
||||||
- margins[i] = cups->PPD->custom_margins[i] / 72.0;
|
|
||||||
- if (xflip == 1)
|
|
||||||
- {
|
|
||||||
- swap = margins[0]; margins[0] = margins[2]; margins[2] = swap;
|
|
||||||
- }
|
|
||||||
- if (yflip == 1)
|
|
||||||
- {
|
|
||||||
- swap = margins[1]; margins[1] = margins[3]; margins[3] = swap;
|
|
||||||
- }
|
|
||||||
+
|
|
||||||
+ /* Rotate page if it only fits into the printer's dimensions
|
|
||||||
+ when rotated */
|
|
||||||
+ if (((cups->MediaSize[0] > cups->PPD->custom_max[0]) ||
|
|
||||||
+ (cups->MediaSize[1] > cups->PPD->custom_max[1])) &&
|
|
||||||
+ ((cups->MediaSize[0] <= cups->PPD->custom_max[1]) &&
|
|
||||||
+ (cups->MediaSize[1] <= cups->PPD->custom_max[0]))) {
|
|
||||||
+ /* Rotate */
|
|
||||||
+ mediasize[0] = cups->MediaSize[1];
|
|
||||||
+ mediasize[1] = cups->MediaSize[0];
|
|
||||||
+
|
|
||||||
+ cups->landscape = 1;
|
|
||||||
+
|
|
||||||
#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
+ if (strcasecmp(cups->header.MediaClass, "PwgRaster") != 0)
|
|
||||||
+ {
|
|
||||||
+#endif
|
|
||||||
+ margins[0] = cups->PPD->custom_margins[3] / 72.0;
|
|
||||||
+ margins[1] = cups->PPD->custom_margins[0] / 72.0;
|
|
||||||
+ margins[2] = cups->PPD->custom_margins[1] / 72.0;
|
|
||||||
+ margins[3] = cups->PPD->custom_margins[2] / 72.0;
|
|
||||||
+ if (xflip == 1)
|
|
||||||
+ {
|
|
||||||
+ swap = margins[1]; margins[1] = margins[3]; margins[3] = swap;
|
|
||||||
}
|
|
||||||
- else
|
|
||||||
+ if (yflip == 1)
|
|
||||||
{
|
|
||||||
- margins[0] = 0.0;
|
|
||||||
- margins[1] = 0.0;
|
|
||||||
- margins[2] = 0.0;
|
|
||||||
- margins[3] = 0.0;
|
|
||||||
+ swap = margins[0]; margins[0] = margins[2]; margins[2] = swap;
|
|
||||||
}
|
|
||||||
+#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ margins[0] = 0.0;
|
|
||||||
+ margins[1] = 0.0;
|
|
||||||
+ margins[2] = 0.0;
|
|
||||||
+ margins[3] = 0.0;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ /* Do not rotate */
|
|
||||||
+ mediasize[0] = cups->MediaSize[0];
|
|
||||||
+ mediasize[1] = cups->MediaSize[1];
|
|
||||||
+
|
|
||||||
+ cups->landscape = 0;
|
|
||||||
+
|
|
||||||
+#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
+ if (strcasecmp(cups->header.MediaClass, "PwgRaster") != 0)
|
|
||||||
+ {
|
|
||||||
#endif
|
|
||||||
+ for (i = 0; i < 4; i ++)
|
|
||||||
+ margins[i] = cups->PPD->custom_margins[i] / 72.0;
|
|
||||||
+ if (xflip == 1)
|
|
||||||
+ {
|
|
||||||
+ swap = margins[0]; margins[0] = margins[2]; margins[2] = swap;
|
|
||||||
+ }
|
|
||||||
+ if (yflip == 1)
|
|
||||||
+ {
|
|
||||||
+ swap = margins[1]; margins[1] = margins[3]; margins[3] = swap;
|
|
||||||
+ }
|
|
||||||
+#ifdef CUPS_RASTER_SYNCv1
|
|
||||||
}
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ margins[0] = 0.0;
|
|
||||||
+ margins[1] = 0.0;
|
|
||||||
+ margins[2] = 0.0;
|
|
||||||
+ margins[3] = 0.0;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.37.3
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
|||||||
From 0b74b65ecc0f36d40b8d04a7fa1fa8b5f9d2b3ff Mon Sep 17 00:00:00 2001
|
|
||||||
From: Chris Liddell <chris.liddell@artifex.com>
|
|
||||||
Date: Thu, 13 Oct 2022 14:55:28 +0100
|
|
||||||
Subject: [PATCH] Deal with different VM modes during CIDFont loading
|
|
||||||
|
|
||||||
To help differentiate between a substituted CIDFont and an embedded one, a
|
|
||||||
change was made to store the file path in the CIDFont dictionary. That change
|
|
||||||
failed to account for the possibility that the file object and the CIDFont
|
|
||||||
dictionary may not be in compatible VM modes.
|
|
||||||
|
|
||||||
This adds code to ensure that the string holding the path is in a suitable VM
|
|
||||||
mode to be stored into the dictionary.
|
|
||||||
|
|
||||||
Reported by Richard Lescak <rlescak@redhat.com>
|
|
||||||
---
|
|
||||||
Resource/Init/gs_cidfn.ps | 23 +++++++++++++++++++----
|
|
||||||
1 file changed, 19 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/Resource/Init/gs_cidfn.ps b/Resource/Init/gs_cidfn.ps
|
|
||||||
index 870a2e11c..fa050ed7a 100644
|
|
||||||
--- a/Resource/Init/gs_cidfn.ps
|
|
||||||
+++ b/Resource/Init/gs_cidfn.ps
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-% Copyright (C) 2001-2021 Artifex Software, Inc.
|
|
||||||
+% Copyright (C) 2001-2022 Artifex Software, Inc.
|
|
||||||
% All Rights Reserved.
|
|
||||||
%
|
|
||||||
% This software is provided AS-IS with no warranty, either express or
|
|
||||||
@@ -36,6 +36,17 @@
|
|
||||||
|
|
||||||
30 dict begin
|
|
||||||
|
|
||||||
+/.gcompatstringcopy % <string> <global> .gcompatstringcopy <string>
|
|
||||||
+{
|
|
||||||
+ dup 2 index gcheck eq
|
|
||||||
+ { pop }
|
|
||||||
+ {
|
|
||||||
+ currentglobal 3 1 roll setglobal
|
|
||||||
+ dup length string copy
|
|
||||||
+ exch setglobal
|
|
||||||
+ } ifelse
|
|
||||||
+} bind def
|
|
||||||
+
|
|
||||||
% The key in .cidfonttypes is the CIDFontType value;
|
|
||||||
% the value is a procedure that takes a font name and the CIDFont dictionary
|
|
||||||
% and replaces the latter with a real font.
|
|
||||||
@@ -58,7 +69,7 @@ dup 0 {
|
|
||||||
end
|
|
||||||
} if
|
|
||||||
1 index exch .buildfont9
|
|
||||||
- .currentresourcefile dup type /filetype eq { //.filename {1 index exch /ResourcePath exch put} if }{ pop} ifelse
|
|
||||||
+ .currentresourcefile dup type /filetype eq { //.filename {1 index gcheck //.gcompatstringcopy exec 1 index exch /ResourcePath exch put} if }{ pop} ifelse
|
|
||||||
exch pop
|
|
||||||
} put % Don't bind it here, because gs_fapi.ps redefines .buildfont9
|
|
||||||
|
|
||||||
@@ -138,10 +149,11 @@ dup 0 {
|
|
||||||
|
|
||||||
% ------ CIDFontType 1 (FontType 10) ------ %
|
|
||||||
|
|
||||||
+
|
|
||||||
dup 1 {
|
|
||||||
10 //.checkfonttype exec pop
|
|
||||||
1 index exch .buildfont10
|
|
||||||
- .currentresourcefile dup type /filetype eq { //.filename {1 index exch /ResourcePath exch put} if }{ pop} ifelse
|
|
||||||
+ .currentresourcefile dup type /filetype eq { //.filename {1 index gcheck //.gcompatstringcopy exec 1 index exch /ResourcePath exch put} if }{ pop} ifelse
|
|
||||||
exch pop
|
|
||||||
} put % Don't bind it here because gs_fapi.ps redefines .buildfont10
|
|
||||||
|
|
||||||
@@ -150,12 +162,15 @@ dup 1 {
|
|
||||||
dup 2 {
|
|
||||||
11 //.checkfonttype exec pop
|
|
||||||
1 index exch .buildfont11
|
|
||||||
- .currentresourcefile dup type /filetype eq { //.filename {1 index exch /ResourcePath exch put} if }{ pop} ifelse
|
|
||||||
+ .currentresourcefile dup type /filetype eq { //.filename {1 index gcheck //.gcompatstringcopy exec 1 index exch /ResourcePath exch put} if }{ pop} ifelse
|
|
||||||
exch pop
|
|
||||||
} put % Don't bind it here because gs_fapi.ps redefines .buildfont11
|
|
||||||
|
|
||||||
+currentdict /.gcompatstringcopy .undef
|
|
||||||
+
|
|
||||||
pop % .cidfonttypes
|
|
||||||
|
|
||||||
+
|
|
||||||
% ---------------- Reading CIDFontType 0 files ---------------- %
|
|
||||||
|
|
||||||
/StartData { % <(Binary)|(Hex)> <datalength> StartData -
|
|
||||||
--
|
|
||||||
2.37.3
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
|||||||
From a3768a91418925a5eb5cf268222f1e90e1abc396 Mon Sep 17 00:00:00 2001
|
|
||||||
Message-Id: <a3768a91418925a5eb5cf268222f1e90e1abc396.1664963046.git.mjg@fedoraproject.org>
|
|
||||||
From: Chris Liddell <chris.liddell@artifex.com>
|
|
||||||
Date: Mon, 3 Oct 2022 16:17:56 +0100
|
|
||||||
Subject: [PATCH] Bug 705863: Fix color info juggling with x11 devices
|
|
||||||
|
|
||||||
For the "wrapped" X11 devices (x11cmyk, x11gray2, x11gray4 etc) we have to
|
|
||||||
juggle the color info between the wrapping device and the wrapped device so that
|
|
||||||
the put/get_params continue to work properly, and not cause bad rendering and
|
|
||||||
segfaults.
|
|
||||||
|
|
||||||
The "wrapped" x11 device initialises with 24bit RGB color setup, and doesn't get
|
|
||||||
updated to match the actual display until the device is opened.
|
|
||||||
|
|
||||||
The problem was, if it was not talking to a 24bit RGB X display, the stashed
|
|
||||||
color_info did not match the actual color_info of the actual device, and
|
|
||||||
resulted in segfaults when using wrapped devices on those non 24bit RGB
|
|
||||||
displays.
|
|
||||||
|
|
||||||
This just ensures the stashed color_info gets updated after those devices config
|
|
||||||
changes take place.
|
|
||||||
|
|
||||||
Also reverts "Bug 703013: Fix color_info for buffered/wrapped X11 devices"
|
|
||||||
commit: 270438bfda605c258f5841e7917a16fdc2cf7968.
|
|
||||||
|
|
||||||
Signed-off-by: Michael J Gruber <mjg@fedoraproject.org>
|
|
||||||
---
|
|
||||||
devices/gdevxcmp.c | 4 ++--
|
|
||||||
devices/gdevxini.c | 6 +++---
|
|
||||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/devices/gdevxcmp.c b/devices/gdevxcmp.c
|
|
||||||
index c43426d76..55051763b 100644
|
|
||||||
--- a/devices/gdevxcmp.c
|
|
||||||
+++ b/devices/gdevxcmp.c
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
|
|
||||||
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
|
|
||||||
All Rights Reserved.
|
|
||||||
|
|
||||||
This software is provided AS-IS with no warranty, either express or
|
|
||||||
@@ -477,7 +477,7 @@ monochrome:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
-
|
|
||||||
+ xdev->orig_color_info = xdev->color_info;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/devices/gdevxini.c b/devices/gdevxini.c
|
|
||||||
index fafcd42a8..914e88e78 100644
|
|
||||||
--- a/devices/gdevxini.c
|
|
||||||
+++ b/devices/gdevxini.c
|
|
||||||
@@ -589,9 +589,9 @@ x_set_buffer(gx_device_X * xdev)
|
|
||||||
* *But* if we run buffered, we have to use the real specs of the real x11 device.
|
|
||||||
* Hence, the real color_info is saved into orig_color_info, and we use that here.
|
|
||||||
*/
|
|
||||||
- if (mdev == 0 || mdev->color_info.depth != xdev->color_info.depth) {
|
|
||||||
+ if (mdev == 0 || mdev->color_info.depth != xdev->orig_color_info.depth) {
|
|
||||||
const gx_device_memory *mdproto =
|
|
||||||
- gdev_mem_device_for_bits(xdev->color_info.depth);
|
|
||||||
+ gdev_mem_device_for_bits(xdev->orig_color_info.depth);
|
|
||||||
|
|
||||||
if (!mdproto) {
|
|
||||||
buffered = false;
|
|
||||||
@@ -643,7 +643,7 @@ x_set_buffer(gx_device_X * xdev)
|
|
||||||
rc_decrement(mdev->icc_struct, "x_set_buffer");
|
|
||||||
mdev->icc_struct = xdev->icc_struct;
|
|
||||||
rc_increment(xdev->icc_struct);
|
|
||||||
- mdev->color_info = xdev->color_info;
|
|
||||||
+ mdev->color_info = xdev->orig_color_info;
|
|
||||||
mdev->base = xdev->buffer;
|
|
||||||
gdev_mem_open_scan_lines(mdev, xdev->height);
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.38.0.420.gc7a4235b32
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
From 37ed5022cecd584de868933b5b60da2e995b3179 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Ken Sharp <ken.sharp@artifex.com>
|
|
||||||
Date: Fri, 24 Mar 2023 13:19:57 +0000
|
|
||||||
Subject: [PATCH] Graphics library - prevent buffer overrun in (T)BCP encoding
|
|
||||||
|
|
||||||
Bug #706494 "Buffer Overflow in s_xBCPE_process"
|
|
||||||
|
|
||||||
As described in detail in the bug report, if the write buffer is filled
|
|
||||||
to one byte less than full, and we then try to write an escaped
|
|
||||||
character, we overrun the buffer because we don't check before
|
|
||||||
writing two bytes to it.
|
|
||||||
|
|
||||||
This just checks if we have two bytes before starting to write an
|
|
||||||
escaped character and exits if we don't (replacing the consumed byte
|
|
||||||
of the input).
|
|
||||||
|
|
||||||
Up for further discussion; why do we even permit a BCP encoding filter
|
|
||||||
anyway ? I think we should remove this, at least when SAFER is true.
|
|
||||||
---
|
|
||||||
base/sbcp.c | 10 +++++++++-
|
|
||||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/base/sbcp.c b/base/sbcp.c
|
|
||||||
index 979ae0992..47fc233ec 100644
|
|
||||||
--- a/base/sbcp.c
|
|
||||||
+++ b/base/sbcp.c
|
|
||||||
@@ -50,6 +50,14 @@ s_xBCPE_process(stream_state * st, stream_cursor_read * pr,
|
|
||||||
byte ch = *++p;
|
|
||||||
|
|
||||||
if (ch <= 31 && escaped[ch]) {
|
|
||||||
+ /* Make sure we have space to store two characters in the write buffer,
|
|
||||||
+ * if we don't then exit without consuming the input character, we'll process
|
|
||||||
+ * that on the next time round.
|
|
||||||
+ */
|
|
||||||
+ if (pw->limit - q < 2) {
|
|
||||||
+ p--;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
if (p == rlimit) {
|
|
||||||
p--;
|
|
||||||
break;
|
|
||||||
--
|
|
||||||
2.39.2
|
|
||||||
|
|
@ -44,8 +44,8 @@
|
|||||||
|
|
||||||
Name: ghostscript
|
Name: ghostscript
|
||||||
Summary: Interpreter for PostScript language & PDF
|
Summary: Interpreter for PostScript language & PDF
|
||||||
Version: 10.01.0
|
Version: 10.01.2
|
||||||
Release: 3%{?dist}
|
Release: 1%{?dist}
|
||||||
|
|
||||||
License: AGPL-3.0-or-later
|
License: AGPL-3.0-or-later
|
||||||
|
|
||||||
@ -108,7 +108,6 @@ BuildRequires: make
|
|||||||
|
|
||||||
Patch001: ghostscript-10.01.0-pdfwrite-Substituted-TTF-CIDFont-CID-hand.patch
|
Patch001: ghostscript-10.01.0-pdfwrite-Substituted-TTF-CIDFont-CID-hand.patch
|
||||||
Patch002: ghostscript-10.01.0-convert-defaultpage-to-lowercase.patch
|
Patch002: ghostscript-10.01.0-convert-defaultpage-to-lowercase.patch
|
||||||
Patch003: ghostscript-10.01.0-CVE-2023-28879.patch
|
|
||||||
|
|
||||||
|
|
||||||
# Downstream patches -- these should be always included when doing rebase:
|
# Downstream patches -- these should be always included when doing rebase:
|
||||||
@ -423,6 +422,10 @@ done
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Jul 14 2023 Michael J Gruber <mjg@fedoraproject.org> - 10.01.2-1
|
||||||
|
- rebase to bugfix release 10.01.2 (rhbz#2182090)
|
||||||
|
- fix for CVE-2023-36664 (rhbz#2217806)
|
||||||
|
|
||||||
* Thu Apr 06 2023 Richard Lescak <rlescak@redhat.com> - 10.01.0-3
|
* Thu Apr 06 2023 Richard Lescak <rlescak@redhat.com> - 10.01.0-3
|
||||||
- fix for CVE-2023-28879 (#2184586)
|
- fix for CVE-2023-28879 (#2184586)
|
||||||
- add patch for converting default page name to lowercase (#2183166)
|
- add patch for converting default page name to lowercase (#2183166)
|
||||||
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
SHA512 (ghostscript-10.01.0.tar.xz) = b679b35bcdcf211d6aa41a571225a50449e7e36def75cf37fee8f06889df3a5a9726a7aef2fd5ae819c2071cb6fcf8712741cd2c131c9341b60936e684bd8d98
|
SHA512 (ghostscript-10.01.2.tar.xz) = ee20f0e12f553a3d04578e71a0d45defebc71117ce4dc2c14043985bfe7348ad7f8b2fe98fc9b4f5b935ecb32e50dc340be67d6ef58190542ec6d0f9da1de380
|
||||||
|
Loading…
Reference in New Issue
Block a user