Skip to content

Commit 163dd01

Browse files
committedMay 14, 2017
freetype: fix CVE-2017-{8105,8287} by upstream patches
I copied the patches, as the changelog changes would certainly conflict. (cherry picked from commit b0d2de4)
1 parent ee7db07 commit 163dd01

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=f958c48ee43
2+
3+
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
4+
index af7b465..7dd4513 100644
5+
--- a/src/psaux/t1decode.c
6+
+++ b/src/psaux/t1decode.c
7+
@@ -780,10 +780,19 @@
8+
/* point without adding any point to the outline */
9+
idx = decoder->num_flex_vectors++;
10+
if ( idx > 0 && idx < 7 )
11+
+ {
12+
+ /* in malformed fonts it is possible to have other */
13+
+ /* opcodes in the middle of a flex (which don't */
14+
+ /* increase `num_flex_vectors'); we thus have to */
15+
+ /* check whether we can add a point */
16+
+ if ( FT_SET_ERROR( t1_builder_check_points( builder, 1 ) ) )
17+
+ goto Syntax_Error;
18+
+
19+
t1_builder_add_point( builder,
20+
x,
21+
y,
22+
(FT_Byte)( idx == 3 || idx == 6 ) );
23+
+ }
24+
}
25+
break;
26+
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=3774fc08b
2+
3+
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
4+
index d18e821..0baf836 100644
5+
--- a/src/psaux/psobjs.c
6+
+++ b/src/psaux/psobjs.c
7+
@@ -1718,6 +1718,14 @@
8+
first = outline->n_contours <= 1
9+
? 0 : outline->contours[outline->n_contours - 2] + 1;
10+
11+
+ /* in malformed fonts it can happen that a contour was started */
12+
+ /* but no points were added */
13+
+ if ( outline->n_contours && first == outline->n_points )
14+
+ {
15+
+ outline->n_contours--;
16+
+ return;
17+
+ }
18+
+
19+
/* We must not include the last point in the path if it */
20+
/* is located on the first point. */
21+
if ( outline->n_points > 1 )
22+

‎pkgs/development/libraries/freetype/default.nix

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ stdenv.mkDerivation rec {
3737
url = "http://pkgs.fedoraproject.org/cgit/rpms/freetype.git/plain/freetype-2.2.1-enable-valid.patch?id=9a81147af83b1166a5f301e379f85927cc610990";
3838
sha256 = "0zkgqhws2s0j8ywksclf391iijhidb1a406zszd7xbdjn28kmj2l";
3939
})
40+
# remove the two CVE patches after updating to >= 2.8
41+
./cve-2017-8105.patch
42+
./cve-2017-8287.patch
4043
] ++ optionals (!useInfinality && useEncumberedCode) [
4144
# Patch to enable subpixel rendering.
4245
# See https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html.

0 commit comments

Comments
 (0)
Please sign in to comment.