diff --git a/.cairo.metadata b/.cairo.metadata index 3bc8d1a..c6da4f8 100644 --- a/.cairo.metadata +++ b/.cairo.metadata @@ -1 +1 @@ -9106ab09b2e7b9f90521b18dd4a7e9577eba6c15 SOURCES/cairo-1.12.14.tar.xz +c8da68aa66ca0855b5d0ff552766d3e8679e1d24 SOURCES/cairo-1.14.2.tar.xz diff --git a/.gitignore b/.gitignore index 2e00cbb..584df0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/cairo-1.12.14.tar.xz +SOURCES/cairo-1.14.2.tar.xz diff --git a/SOURCES/0001-xlib-Don-t-crash-when-swapping-a-0-sized-glyph.patch b/SOURCES/0001-xlib-Don-t-crash-when-swapping-a-0-sized-glyph.patch deleted file mode 100644 index c94d7b3..0000000 --- a/SOURCES/0001-xlib-Don-t-crash-when-swapping-a-0-sized-glyph.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 8dc3b629434ce256f8e6a584c5853ae9b4230c33 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Wed, 31 Oct 2012 16:06:51 -0400 -Subject: [PATCH 1/2] xlib: Don't crash when swapping a 0-sized glyph - -malloc(0) needn't return NULL, and on glibc, doesn't. Then we encounter -a loop of the form do { ... } while (--c), which doesn't do quite what -you were hoping for when c is initially 0. - -Since there's nothing to swap in this case, just bomb out. - -Signed-off-by: Adam Jackson ---- - src/cairo-xlib-render-compositor.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c -index 74c43e9..e38a659 100644 ---- a/src/cairo-xlib-render-compositor.c -+++ b/src/cairo-xlib-render-compositor.c -@@ -1251,6 +1251,9 @@ _cairo_xlib_surface_add_glyph (cairo_xlib_display_t *display, - unsigned char *d; - unsigned char *new, *n; - -+ if (c == 0) -+ break; -+ - new = malloc (c); - if (!new) { - status = _cairo_error (CAIRO_STATUS_NO_MEMORY); -@@ -1276,6 +1279,9 @@ _cairo_xlib_surface_add_glyph (cairo_xlib_display_t *display, - const uint32_t *d; - uint32_t *new, *n; - -+ if (c == 0) -+ break; -+ - new = malloc (4 * c); - if (unlikely (new == NULL)) { - status = _cairo_error (CAIRO_STATUS_NO_MEMORY); --- -1.7.12.1 - diff --git a/SOURCES/0002-xcb-Don-t-crash-when-swapping-a-0-sized-glyph.patch b/SOURCES/0002-xcb-Don-t-crash-when-swapping-a-0-sized-glyph.patch deleted file mode 100644 index 7d2b405..0000000 --- a/SOURCES/0002-xcb-Don-t-crash-when-swapping-a-0-sized-glyph.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 4cad9bf9f0744efe17f1b70548cd2059df071e81 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Wed, 31 Oct 2012 16:12:58 -0400 -Subject: [PATCH 2/2] xcb: Don't crash when swapping a 0-sized glyph - -malloc(0) needn't return NULL, and on glibc, doesn't. Then we encounter -a loop of the form do { ... } while (--c), which doesn't do quite what -you were hoping for when c is initially 0. - -Since there's nothing to swap in this case, just bomb out. - -Signed-off-by: Adam Jackson ---- - src/cairo-xcb-surface-render.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c -index 27ed113..16d1ef8 100644 ---- a/src/cairo-xcb-surface-render.c -+++ b/src/cairo-xcb-surface-render.c -@@ -4461,6 +4461,9 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection, - const uint8_t *d; - uint8_t *new, *n; - -+ if (c == 0) -+ break; -+ - new = malloc (c); - if (unlikely (new == NULL)) { - status = _cairo_error (CAIRO_STATUS_NO_MEMORY); -@@ -4489,6 +4492,9 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection, - const uint32_t *d; - uint32_t *new, *n; - -+ if (c == 0) -+ break; -+ - new = malloc (4 * c); - if (unlikely (new == NULL)) { - status = _cairo_error (CAIRO_STATUS_NO_MEMORY); --- -1.7.12.1 - diff --git a/SOURCES/0003-mempool-Reduce-an-assert-into-an-error-return-for-ge.patch b/SOURCES/0003-mempool-Reduce-an-assert-into-an-error-return-for-ge.patch deleted file mode 100644 index 9d29b2b..0000000 --- a/SOURCES/0003-mempool-Reduce-an-assert-into-an-error-return-for-ge.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 01a8bf01c6508a4fea8d40371c3049e7a2f7908a Mon Sep 17 00:00:00 2001 -From: Chris Wilson -Date: Fri, 15 Mar 2013 09:08:00 +0000 -Subject: [PATCH] mempool: Reduce an assert into an error return for - get_buddy() - -If we ask for a buddy that is outside of our allocation that is an -error that should not happen with a power-of-two allocated zone... -However, since it has been seen in the wild, we can safely return that -there is no buddy rather than die in a too-late assert. - -Reported-by: Anton Eliasson -Signed-off-by: Chris Wilson ---- - src/cairo-mempool.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/cairo-mempool.c b/src/cairo-mempool.c -index 96e4a62..751ede3 100644 ---- a/src/cairo-mempool.c -+++ b/src/cairo-mempool.c -@@ -157,7 +157,8 @@ get_buddy (cairo_mempool_t *pool, size_t offset, int bits) - { - struct _cairo_memblock *block; - -- assert (offset + (1 << bits) <= pool->num_blocks); -+ if (offset + (1 << bits) >= pool->num_blocks) -+ return NULL; /* invalid */ - - if (BITTEST (pool, offset + (1 << bits) - 1)) - return NULL; /* buddy is allocated */ --- -1.8.1.4 - diff --git a/SOURCES/0004-font-Generate-PDFs-with-correct-font-names.patch b/SOURCES/0004-font-Generate-PDFs-with-correct-font-names.patch deleted file mode 100644 index 6fb4c1e..0000000 --- a/SOURCES/0004-font-Generate-PDFs-with-correct-font-names.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 97f6e2005d9cbc9c9dd7cc21445df7c08e084c83 Mon Sep 17 00:00:00 2001 -From: Marek Kasik -Date: Thu, 9 Jan 2014 17:28:32 +0100 -Subject: [PATCH] font: Generate PDFs with correct font names - -Escape PostScript names of loaded fonts. These can not -contain white spaces and delimiter characters when saving -them to a PostScript file or a PDF file. ---- - src/cairo-cff-subset.c | 2 ++ - src/cairo-scaled-font-subsets-private.h | 15 +++++++++++++ - src/cairo-scaled-font-subsets.c | 40 +++++++++++++++++++++++++++++++++ - src/cairo-truetype-subset.c | 35 +++-------------------------- - src/cairo-type1-subset.c | 9 +++----- - 5 files changed, 63 insertions(+), 38 deletions(-) - -diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c -index c420bd4..1ae032c 100644 ---- a/src/cairo-cff-subset.c -+++ b/src/cairo-cff-subset.c -@@ -899,6 +899,8 @@ cairo_cff_font_read_name (cairo_cff_font_t *font) - - memcpy (font->ps_name, p, len); - font->ps_name[len] = 0; -+ -+ status = _cairo_escape_ps_name (&font->ps_name); - } - cff_index_fini (&index); - -diff --git a/src/cairo-scaled-font-subsets-private.h b/src/cairo-scaled-font-subsets-private.h -index dd19962..866e63d 100644 ---- a/src/cairo-scaled-font-subsets-private.h -+++ b/src/cairo-scaled-font-subsets-private.h -@@ -715,6 +715,21 @@ _cairo_truetype_get_style (cairo_scaled_font_t *scaled_font, - cairo_bool_t *bold, - cairo_bool_t *italic); - -+/** -+ * _cairo_escape_ps_name: -+ * @ps_name: returns the PostScript name with all invalid characters escaped -+ * -+ * Ensure that PostSript name is a valid PDF/PostSript name object. -+ * In PDF names are treated as UTF8 and non ASCII bytes, ' ', -+ * and '#' are encoded as '#' followed by 2 hex digits that -+ * encode the byte. -+ * -+ * Return value: %CAIRO_STATUS_SUCCESS if successful. Possible errors include -+ * %CAIRO_STATUS_NO_MEMORY. -+ **/ -+cairo_private cairo_int_status_t -+_cairo_escape_ps_name (char **ps_name); -+ - #endif /* CAIRO_HAS_FONT_SUBSET */ - - #endif /* CAIRO_SCALED_FONT_SUBSETS_PRIVATE_H */ -diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c -index e78e0c2..2121761 100644 ---- a/src/cairo-scaled-font-subsets.c -+++ b/src/cairo-scaled-font-subsets.c -@@ -1256,4 +1256,44 @@ CLEANUP_HASH: - return status; - } - -+cairo_int_status_t -+_cairo_escape_ps_name (char **ps_name) -+{ -+ cairo_status_t status = CAIRO_STATUS_SUCCESS; -+ -+ /* Ensure PS name is a valid PDF/PS name object. In PDF names are -+ * treated as UTF8 and non ASCII bytes, ' ', and '#' are encoded -+ * as '#' followed by 2 hex digits that encode the byte. By also -+ * encoding the characters in the reserved string we ensure the -+ * name is also PS compatible. */ -+ if (*ps_name) { -+ static const char *reserved = "()<>[]{}/%#\\"; -+ char buf[128]; /* max name length is 127 bytes */ -+ char *src = *ps_name; -+ char *dst = buf; -+ -+ while (*src && dst < buf + 127) { -+ unsigned char c = *src; -+ if (c < 0x21 || c > 0x7e || strchr (reserved, c)) { -+ if (dst + 4 > buf + 127) -+ break; -+ -+ snprintf (dst, 4, "#%02X", c); -+ src++; -+ dst += 3; -+ } else { -+ *dst++ = *src++; -+ } -+ } -+ *dst = 0; -+ free (*ps_name); -+ *ps_name = strdup (buf); -+ if (*ps_name == NULL) { -+ status = _cairo_error (CAIRO_STATUS_NO_MEMORY); -+ } -+ } -+ -+ return status; -+} -+ - #endif /* CAIRO_HAS_FONT_SUBSET */ -diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c -index 18ee685..3d55fef 100644 ---- a/src/cairo-truetype-subset.c -+++ b/src/cairo-truetype-subset.c -@@ -1566,38 +1566,9 @@ _cairo_truetype_read_font_name (cairo_scaled_font_t *scaled_font, - - free (name); - -- /* Ensure PS name is a valid PDF/PS name object. In PDF names are -- * treated as UTF8 and non ASCII bytes, ' ', and '#' are encoded -- * as '#' followed by 2 hex digits that encode the byte. By also -- * encoding the characters in the reserved string we ensure the -- * name is also PS compatible. */ -- if (ps_name) { -- static const char *reserved = "()<>[]{}/%#\\"; -- char buf[128]; /* max name length is 127 bytes */ -- char *src = ps_name; -- char *dst = buf; -- -- while (*src && dst < buf + 127) { -- unsigned char c = *src; -- if (c < 0x21 || c > 0x7e || strchr (reserved, c)) { -- if (dst + 4 > buf + 127) -- break; -- -- snprintf (dst, 4, "#%02X", c); -- src++; -- dst += 3; -- } else { -- *dst++ = *src++; -- } -- } -- *dst = 0; -- free (ps_name); -- ps_name = strdup (buf); -- if (ps_name == NULL) { -- status = _cairo_error (CAIRO_STATUS_NO_MEMORY); -- goto fail; -- } -- } -+ status = _cairo_escape_ps_name (&ps_name); -+ if (unlikely(status)) -+ goto fail; - - *ps_name_out = ps_name; - *font_name_out = family_name; -diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c -index 99830b4..3b2cc0a 100644 ---- a/src/cairo-type1-subset.c -+++ b/src/cairo-type1-subset.c -@@ -407,6 +407,7 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font) - const char *start, *end, *segment_end; - char *s; - int i; -+ cairo_status_t status; - - segment_end = font->header_segment + font->header_segment_size; - start = find_token (font->header_segment, segment_end, "/FontName"); -@@ -447,13 +448,9 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font) - if (unlikely (font->base.base_font == NULL)) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); - -- s = font->base.base_font; -- while (*s && !is_ps_delimiter(*s)) -- s++; -- -- *s = 0; -+ status = _cairo_escape_ps_name (&font->base.base_font); - -- return CAIRO_STATUS_SUCCESS; -+ return status; - } - - static cairo_status_t --- -1.8.4.2 - diff --git a/SPECS/cairo.spec b/SPECS/cairo.spec index a49a40e..100d5dd 100644 --- a/SPECS/cairo.spec +++ b/SPECS/cairo.spec @@ -1,23 +1,17 @@ -%define pixman_version 0.18.4 +%define pixman_version 0.30.0 %define freetype_version 2.1.9 %define fontconfig_version 2.2.95 Summary: A 2D graphics library Name: cairo -Version: 1.12.14 -Release: 6%{?dist} +Version: 1.14.2 +Release: 1%{?dist} URL: http://cairographics.org -#VCS: git:git://git.freedesktop.org/git/cairo -#Source0: http://cairographics.org/snapshots/%{name}-%{version}.tar.gz Source0: http://cairographics.org/releases/%{name}-%{version}.tar.xz License: LGPLv2 or MPLv1.1 Group: System Environment/Libraries -Patch0: 0001-xlib-Don-t-crash-when-swapping-a-0-sized-glyph.patch -Patch1: 0002-xcb-Don-t-crash-when-swapping-a-0-sized-glyph.patch -Patch2: 0003-mempool-Reduce-an-assert-into-an-error-return-for-ge.patch -Patch3: 0004-font-Generate-PDFs-with-correct-font-names.patch -Patch4: cairo-multilib.patch +Patch3: cairo-multilib.patch BuildRequires: pkgconfig BuildRequires: libXrender-devel @@ -45,12 +39,7 @@ through the X Render Extension or OpenGL). %package devel Summary: Development files for cairo Group: Development/Libraries -Requires: %{name} = %{version}-%{release} -Requires: libXrender-devel -Requires: libpng-devel -Requires: pixman-devel >= %{pixman_version} -Requires: freetype-devel >= %{freetype_version} -Requires: fontconfig-devel >= %{fontconfig_version} +Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Cairo is a 2D graphics library designed to provide high-quality display @@ -62,7 +51,7 @@ needed for developing software which uses the cairo graphics library. %package gobject Summary: GObject bindings for cairo Group: System Environment/Libraries -Requires: %{name} = %{version}-%{release} +Requires: %{name}%{?_isa} = %{version}-%{release} %description gobject Cairo is a 2D graphics library designed to provide high-quality display @@ -74,8 +63,8 @@ integrate well with the GObject object system used by GNOME. %package gobject-devel Summary: Development files for cairo-gobject Group: Development/Libraries -Requires: %{name}-devel = %{version}-%{release} -Requires: %{name}-gobject = %{version}-%{release} +Requires: %{name}-devel%{?_isa} = %{version}-%{release} +Requires: %{name}-gobject%{?_isa} = %{version}-%{release} %description gobject-devel Cairo is a 2D graphics library designed to provide high-quality display @@ -97,11 +86,7 @@ This package contains tools for working with the cairo graphics library. %prep %setup -q -%patch0 -p1 -b .xlib-swap -%patch1 -p1 -b .xcb-swap -%patch2 -p1 -b .get_buddy-assert -%patch3 -p1 -b .font-name -%patch4 -p1 -b .multilib +%patch3 -p1 -b .multilib %build %configure --disable-static \ @@ -185,6 +170,10 @@ rm $RPM_BUILD_ROOT%{_libdir}/*.la %{_libdir}/cairo/ %changelog +* Tue Apr 28 2015 Benjamin Otte - 1.14.2-1 +- Update to 1.14.2 +- Resolves: #1174435 + * Thu Feb 6 2014 Benjamin Otte - 1.12.14-6 - Add patch to properly escape font names in PDFs