freebsd-ports/print/ghostscript7-base/files/patch-src:zmedia2.c
Hiroki Sato 27470e1676 - Split ghostscript into X11-independent and -dependent parts:
* print/ghostscript{7,8,9,9-agpl}-base

   Installs Ghostscript binary, libgs, and related files.
   These ports do not depend on X11 libraries (i.e. x11* devices
   are not available).  USES=ghostscript will set dependency on
   one of them depending on GHOSTSCRIPT_DEFAULT.

   The default device is set to "display" or "bbox".

 * print/ghostscript{7,8,9,9-agpl}-x11

   Installs a shared library which provides X11 support to
   the installed Ghostscript binaries.  x11* devices will be
   enabled when the library is available.

   This depends on *-base (RUN_DEPENDS).  USES=ghostscript:x11
   will set dependency on one of them.

- Fix integer overflow reported as CVE-2015-3228.

- Update Uses/ghostscript.mk:

 * Add x11 keyword.  nox11 keyword is now obsolete.

 * Use packagename in *_DEPENDS line to prevent relationship between
   -base and -x11 packages from being broken.

- Fix x11/nox11 keyword and bump PORTREVISION in ports using
  USES=ghostscript to update dependency of pre-compiled packages.
2015-08-22 17:48:35 +00:00

25 lines
1 KiB
C

--- src/zmedia2.c.orig Fri Apr 27 02:57:41 2001
+++ src/zmedia2.c Fri Nov 2 04:08:16 2001
@@ -429,11 +429,17 @@
rx = ry, ry = temp;
}
- /* Adjust the medium size if flexible. */
- if (medium->p.x < MIN_MEDIA_SIZE && mx > rx)
- mx = rx;
- if (medium->p.y < MIN_MEDIA_SIZE && my > ry)
- my = ry;
+ /* If 'medium' is flexible, adjust 'mx' and 'my' towards 'rx' and 'ry',
+ respectively. Note that 'mx' and 'my' have just acquired the largest
+ permissible value, medium->q. */
+ if (medium->p.x < mx) /* non-empty width range */
+ if (rx < medium->p.x) mx = medium->p.x; /* minimum */
+ else if (mx > rx) mx = rx; /* fits */
+ /* else use medium->q.x, i.e., the maximum */
+ if (medium->p.y < my) /* non-empty height range */
+ if (ry < medium->p.y) my = medium->p.y; /* minimum */
+ else if (my > ry) my = ry; /* fits */
+ /* else use medium->q.y, i.e., the maximum */
/* Translate to align the centers. */
gs_make_translation(mx / 2, my / 2, pmat);