Merge pull request #1448 from harfbuzz/cff-leak

[CFF] fix leak: oss-fuzz 11662
This commit is contained in:
Ebrahim Byagowi 2018-12-05 13:23:23 +03:30 committed by GitHub
commit cf4b7db6b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -1092,6 +1092,7 @@ struct cff1
CFF1FontDict_Interpreter font_interp;
font_interp.env.init (fontDictStr);
font = fontDicts.push ();
if (unlikely (font == &Crap(CFF1FontDictValues))) { fini (); return; }
font->init ();
if (unlikely (!font_interp.interpret (*font))) { fini (); return; }
PRIVDICTVAL *priv = &privateDicts[i];
@ -1131,7 +1132,7 @@ struct cff1
{
sc.end_processing ();
topDict.fini ();
fontDicts.fini ();
fontDicts.fini_deep ();
privateDicts.fini_deep ();
hb_blob_destroy (blob);
blob = nullptr;

View File

@ -486,6 +486,7 @@ struct cff2
CFF2FontDict_Interpreter font_interp;
font_interp.env.init (fontDictStr);
font = fontDicts.push ();
if (unlikely (font == &Crap(CFF2FontDictValues))) { fini (); return; }
font->init ();
if (unlikely (!font_interp.interpret (*font))) { fini (); return; }
@ -506,7 +507,7 @@ struct cff2
inline void fini (void)
{
sc.end_processing ();
fontDicts.fini ();
fontDicts.fini_deep ();
privateDicts.fini_deep ();
hb_blob_destroy (blob);
blob = nullptr;