* src/cid/cidgload.c (cid_slot_load_glyph): Fix memory leak. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3489
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
diff --git a/ChangeLog b/ChangeLog
index c1a9b32..9d0bbbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-28 Ewald Hew <ewaldhew@gmail.com>
+
+ * src/cid/cidgload.c (cid_slot_load_glyph): Fix memory leak.
+
+ Reported as
+
+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3489
+
2017-09-28 Alexei Podtelezhnikov <apodtele@gmail.com>
Bitmap metrics presetting [1/2].
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index e8a2be3..f0b4988 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -335,6 +335,7 @@
PSAux_Service psaux = (PSAux_Service)face->psaux;
FT_Matrix font_matrix;
FT_Vector font_offset;
+ FT_Bool must_finish_decoder = FALSE;
if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
@@ -375,6 +376,8 @@
/* TODO: initialize decoder.len_buildchar and decoder.buildchar */
/* if we ever support CID-keyed multiple master fonts */
+ must_finish_decoder = TRUE;
+
/* set up the decoder */
decoder.builder.no_recurse = FT_BOOL(
( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) );
@@ -393,6 +396,8 @@
/* save new glyph tables */
psaux->t1_decoder_funcs->done( &decoder );
+ must_finish_decoder = FALSE;
+
/* now set the metrics -- this is rather simple, as */
/* the left side bearing is the xMin, and the top side */
/* bearing the yMax */
@@ -501,6 +506,10 @@
}
Exit:
+
+ if ( must_finish_decoder )
+ psaux->t1_decoder_funcs->done( &decoder );
+
return error;
}