Compare commits

...
Sign in to create a new pull request.

3 commits

Author SHA1 Message Date
Akira TAGOH
6981f331cf Fix the matching function for postscriptname property.
Resolves: rhbz#1946871
2022-03-03 18:02:49 +09:00
Akira TAGOH
1e108c811c Fix the matching function for postscriptname property.
Resolves: rhbz#1946871
2022-03-03 17:56:12 +09:00
Akira TAGOH
4a191dc3c0 Fix a memory leak.
Resolves: rhbz#1914716
2022-03-02 20:41:47 +09:00
3 changed files with 103 additions and 1 deletions

44
fontconfig-1914716.patch Normal file
View file

@ -0,0 +1,44 @@
From 57032f489b2cbe98c8e7927f4c18738869831f41 Mon Sep 17 00:00:00 2001
From: Akira TAGOH <akira@tagoh.org>
Date: Wed, 25 Aug 2021 15:52:53 +0900
Subject: [PATCH] Fix a memory leak when trying to open a non-existing file
https://bugzilla.redhat.com/show_bug.cgi?id=1914716
---
src/fccache.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/fccache.c b/src/fccache.c
index ae3b9e3..d8ffe09 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -1111,7 +1111,7 @@ FcCache *
FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
{
int fd;
- FcCache *cache;
+ FcCache *cache = NULL;
struct stat my_file_stat;
FcConfig *config;
@@ -1121,11 +1121,13 @@ FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
if (!config)
return NULL;
fd = FcDirCacheOpenFile (cache_file, file_stat);
- if (fd < 0)
- return NULL;
- cache = FcDirCacheMapFd (config, fd, file_stat, NULL);
+ if (fd >= 0)
+ {
+ cache = FcDirCacheMapFd (config, fd, file_stat, NULL);
+ close (fd);
+ }
FcConfigDestroy (config);
- close (fd);
+
return cache;
}
--
2.35.1

48
fontconfig-1946871.patch Normal file
View file

@ -0,0 +1,48 @@
From 2d17232a45c55cdb8d082a3bcf13d423928fcd5e Mon Sep 17 00:00:00 2001
From: Akira TAGOH <akira@tagoh.org>
Date: Fri, 8 Oct 2021 18:29:48 +0900
Subject: [PATCH] Fix score estimation for postscriptname
Before this fix:
$ fc-match :postscriptname=LiberationSans
LiberationSansNarrow.ttf: "Liberation Sans Narrow" "Regular"
After this fix:
$ fc-match :postscriptname=LiberationSans
LiberationSans-Regular.ttf: "Liberation Sans" "Regular"
See https://bugzilla.redhat.com/show_bug.cgi?id=1946871
---
src/fcmatch.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/fcmatch.c b/src/fcmatch.c
index 80d5687..cf0876c 100644
--- a/src/fcmatch.c
+++ b/src/fcmatch.c
@@ -86,7 +86,7 @@ FcComparePostScript (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
const FcChar8 *v1_string = FcValueString (v1);
const FcChar8 *v2_string = FcValueString (v2);
int n;
- size_t len;
+ size_t len1, len2, mlen;
*bestValue = FcValueCanonicalize (v2);
@@ -95,9 +95,11 @@ FcComparePostScript (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
return 1.0;
n = FcStrMatchIgnoreCaseAndDelims (v1_string, v2_string, (const FcChar8 *)" -");
- len = strlen ((const char *)v1_string);
+ len1 = strlen ((const char *)v1_string);
+ len2 = strlen ((const char *)v2_string);
+ mlen = FC_MAX (len1, len2);
- return (double)(len - n) / (double)len;
+ return (double)(mlen - n) / (double)mlen;
}
static double
--
2.35.1

View file

@ -5,7 +5,7 @@
Summary: Font configuration and customization library
Name: fontconfig
Version: 2.13.94
Release: 3%{?dist}
Release: 5%{?dist}
# src/ftglue.[ch] is in Public Domain
# src/fccache.c contains Public Domain code
# fc-case/CaseFolding.txt is in the UCD
@ -22,6 +22,8 @@ Patch4: %{name}-drop-lang-from-pkgkit-format.patch
Patch5: %{name}-disable-network-required-test.patch
Patch6: %{name}-score-fix.patch
Patch7: %{name}-lcdfilter.patch
Patch8: %{name}-1914716.patch
Patch9: %{name}-1946871.patch
BuildRequires: libxml2-devel
BuildRequires: freetype-devel >= %{freetype_version}
@ -189,6 +191,14 @@ fi
%doc fontconfig-devel.txt fontconfig-devel
%changelog
* Thu Mar 3 2022 Akira TAGOH <tagoh@redhat.com> - 2.13.94-5
- Fix the matching function for postscriptname property.
Resolves: rhbz#1946871
* Wed Mar 2 2022 Akira TAGOH <tagoh@redhat.com> - 2.13.94-4
- Fix a memory leak.
Resolves: rhbz#1914716
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.13.94-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild