Merged update from upstream sources
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/cairo.git#a0683cb6188555523851c1a5c89d8e64a8f58767
This commit is contained in:
parent
30d19df3a1
commit
111317990a
58
125.patch
Normal file
58
125.patch
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
From a3b69a0215fdface0fd5730872a4b3242d979dca Mon Sep 17 00:00:00 2001
|
||||||
|
From: Uli Schlachter <psychon@znc.in>
|
||||||
|
Date: Tue, 9 Feb 2021 16:54:35 +0100
|
||||||
|
Subject: [PATCH] pdf font subset: Generate valid font names
|
||||||
|
|
||||||
|
A hash value is encoded in base 26 with upper case letters for font
|
||||||
|
names.
|
||||||
|
|
||||||
|
Commit ed984146 replaced "numerator = abs (hash);" with "numerator =
|
||||||
|
hash;" in this code, because hash has type uint32_t and the compiler
|
||||||
|
warned about taking the absolute value of an unsigned value. However,
|
||||||
|
abs() is actually defined to take an int argument. Thus, there was some
|
||||||
|
implicit cast.
|
||||||
|
|
||||||
|
Since numerator has type long, i.e. is signed, it is now actually
|
||||||
|
possible to get an overflow in the implicit cast and then have a
|
||||||
|
negative number. The following code is not prepared for this and
|
||||||
|
produces non-letters when encoding the hash.
|
||||||
|
|
||||||
|
This commit fixes that problem by not using ldiv() and instead using /
|
||||||
|
and % to directly compute the needed values. This gets rid of the need
|
||||||
|
to convert to type long. Since now everything works with uint32_t, there
|
||||||
|
is no more chance for negative numbers messing things up.
|
||||||
|
|
||||||
|
Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/449
|
||||||
|
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
||||||
|
---
|
||||||
|
src/cairo-pdf-surface.c | 8 ++------
|
||||||
|
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
|
||||||
|
index 6da460878..52c49b6d2 100644
|
||||||
|
--- a/src/cairo-pdf-surface.c
|
||||||
|
+++ b/src/cairo-pdf-surface.c
|
||||||
|
@@ -5310,18 +5310,14 @@ _create_font_subset_tag (cairo_scaled_font_subset_t *font_subset,
|
||||||
|
{
|
||||||
|
uint32_t hash;
|
||||||
|
int i;
|
||||||
|
- long numerator;
|
||||||
|
- ldiv_t d;
|
||||||
|
|
||||||
|
hash = _hash_data ((unsigned char *) font_name, strlen(font_name), 0);
|
||||||
|
hash = _hash_data ((unsigned char *) (font_subset->glyphs),
|
||||||
|
font_subset->num_glyphs * sizeof(unsigned long), hash);
|
||||||
|
|
||||||
|
- numerator = hash;
|
||||||
|
for (i = 0; i < 6; i++) {
|
||||||
|
- d = ldiv (numerator, 26);
|
||||||
|
- numerator = d.quot;
|
||||||
|
- tag[i] = 'A' + d.rem;
|
||||||
|
+ tag[i] = 'A' + (hash % 26);
|
||||||
|
+ hash /= 26;
|
||||||
|
}
|
||||||
|
tag[i] = 0;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
Name: cairo
|
Name: cairo
|
||||||
Version: 1.17.4
|
Version: 1.17.4
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: A 2D graphics library
|
Summary: A 2D graphics library
|
||||||
|
|
||||||
License: LGPLv2 or MPLv1.1
|
License: LGPLv2 or MPLv1.1
|
||||||
@ -23,6 +23,10 @@ Patch3: cairo-multilib.patch
|
|||||||
# https://gitlab.freedesktop.org/cairo/cairo/merge_requests/1
|
# https://gitlab.freedesktop.org/cairo/cairo/merge_requests/1
|
||||||
Patch4: 0001-Set-default-LCD-filter-to-FreeType-s-default.patch
|
Patch4: 0001-Set-default-LCD-filter-to-FreeType-s-default.patch
|
||||||
|
|
||||||
|
# Fix generating PDF font names
|
||||||
|
# https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/125
|
||||||
|
Patch5: 125.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: libXrender-devel
|
BuildRequires: libXrender-devel
|
||||||
@ -173,6 +177,9 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
|
|||||||
%{_libdir}/cairo/
|
%{_libdir}/cairo/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 16 2021 Kalev Lember <klember@redhat.com> - 1.17.4-3
|
||||||
|
- Backport an upstream patch to fix generating PDF font names (#1939399)
|
||||||
|
|
||||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.17.4-2
|
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.17.4-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user