commit 5b0ffa9474c291723f96dffb106c0d7b3c249431
Author: Kevin Kofler <kevin.kofler(a)chello.at>
Date: Wed Jun 7 01:11:10 2017 +0200
Add freetype-2.7.1-loop-counter.patch from Fedora freetype (rh#1456585)
* Tue Jun 06 2017 Kevin Kofler <Kevin(a)tigcc.ticalc.org> 2.7.1-7
- Add freetype-2.7.1-loop-counter.patch from Fedora freetype:
Adjust loop counter maximum for TrueType fonts (rh#1456585)
freetype-2.7.1-loop-counter.patch | 48 +++++++++++++++++++++++++++++++++++++++
freetype-freeworld.spec | 11 ++++++++-
2 files changed, 58 insertions(+), 1 deletion(-)
---
diff --git a/freetype-2.7.1-loop-counter.patch b/freetype-2.7.1-loop-counter.patch
new file mode 100644
index 0000000..4904f90
--- /dev/null
+++ b/freetype-2.7.1-loop-counter.patch
@@ -0,0 +1,48 @@
+--- freetype-2.7.1/src/truetype/ttinterp.c
++++ freetype-2.7.1/src/truetype/ttinterp.c
+@@ -7605,21 +7605,34 @@
+ exc->twilight.n_points = (FT_UShort)num_twilight_points;
+ }
+
+- /* Set up loop detectors. We restrict the number of LOOPCALL loops */
+- /* and the number of JMPR, JROT, and JROF calls with a negative */
+- /* argument to values that depend on the size of the CVT table and */
+- /* the number of points in the current glyph (if applicable). */
+- /* */
+- /* The idea is that in real-world bytecode you either iterate over */
+- /* all CVT entries, or over all points (or contours) of a glyph, and */
+- /* such iterations don't happen very often. */
++ /* Set up loop detectors. We restrict the number of LOOPCALL loops */
++ /* and the number of JMPR, JROT, and JROF calls with a negative */
++ /* argument to values that depend on various parameters like the */
++ /* size of the CVT table or the number of points in the current */
++ /* glyph (if applicable). */
++ /* */
++ /* The idea is that in real-world bytecode you either iterate over */
++ /* all CVT entries (in the `prep' table), or over all points (or */
++ /* contours, in the `glyf' table) of a glyph, and such iterations */
++ /* don't happen very often. */
+ exc->loopcall_counter = 0;
+ exc->neg_jump_counter = 0;
+
+ /* The maximum values are heuristic. */
+- exc->loopcall_counter_max = FT_MAX( 100,
+- 10 * ( exc->pts.n_points +
+- exc->cvtSize ) );
++ if ( exc->pts.n_points )
++ exc->loopcall_counter_max = FT_MAX( 50,
++ 10 * exc->pts.n_points ) +
++ FT_MAX( 50,
++ exc->cvtSize / 10 );
++ else
++ exc->loopcall_counter_max = 300 + 8 * exc->cvtSize;
++
++ /* as a protection against an unreasonable number of CVT entries */
++ /* we assume at most 100 control values per glyph for the counter */
++ if ( exc->loopcall_counter_max >
++ 100 * (FT_ULong)exc->face->root.num_glyphs )
++ exc->loopcall_counter_max = 100 * (FT_ULong)exc->face->root.num_glyphs;
++
+ FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL"
+ " to %d\n", exc->loopcall_counter_max ));
+
diff --git a/freetype-freeworld.spec b/freetype-freeworld.spec
index 805338e..345469c 100644
--- a/freetype-freeworld.spec
+++ b/freetype-freeworld.spec
@@ -1,7 +1,7 @@
Summary: A free and portable font rendering engine
Name: freetype-freeworld
Version: 2.7.1
-Release: 6%{?dist}
+Release: 7%{?dist}
License: (FTL or GPLv2+) and BSD and MIT and Public Domain and zlib with acknowledgement
URL:
http://www.freetype.org
Source:
http://download.savannah.gnu.org/releases/freetype/freetype-%{version}.ta...
@@ -15,6 +15,10 @@ Patch1: freetype-2.2.1-enable-valid.patch
#
https://bugzilla.redhat.com/show_bug.cgi?id=1451795
Patch4: freetype-2.7.1-pcf-encoding.patch
+# Adjust loop counter maximum for TrueType fonts
+#
https://bugzilla.redhat.com/show_bug.cgi?id=1456585
+Patch5: freetype-2.7.1-loop-counter.patch
+
## Security fixes:
#
https://bugzilla.redhat.com/show_bug.cgi?id=1446500
Patch94: freetype-2.7.1-protect-flex-handling.patch
@@ -51,6 +55,7 @@ It transparently overrides the system library using ld.so.conf.d.
%patch1 -p1 -b .enable-valid
%patch4 -p1 -b .pcf-encoding
+%patch5 -p1 -b .loop-counter
%patch94 -p1 -b .protect-flex-handling
%patch95 -p1 -b .safety-guard
@@ -97,6 +102,10 @@ echo "%{_libdir}/%{name}" \
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf
%changelog
+* Tue Jun 06 2017 Kevin Kofler <Kevin(a)tigcc.ticalc.org> 2.7.1-7
+- Add freetype-2.7.1-loop-counter.patch from Fedora freetype:
+ Adjust loop counter maximum for TrueType fonts (rh#1456585)
+
* Sun May 28 2017 Kevin Kofler <Kevin(a)tigcc.ticalc.org> 2.7.1-6
- Add freetype-2.7.1-pcf-encoding.patch from Fedora freetype: Accept
ISO646.1991-IRV as a Unicode charmap in PCF and BDF drivers (rh#1451795)