Blame SOURCES/fontforge-20170731-cve-2020-5395-followup-fix.patch

25f3d8
From b96273acc691ac8a36c6a8dd4de8e6edd7eaae59 Mon Sep 17 00:00:00 2001
25f3d8
From: Fredrick Brennan <copypaste@kittens.ph>
25f3d8
Date: Tue, 21 Jan 2020 15:16:00 +0800
25f3d8
Subject: [PATCH] Fix crash on exit introduced in previous commit
25f3d8
25f3d8
When the number of layers is greater than 2, as in Chomsky.sfd and most
25f3d8
of my other fonts, FontForge will crash on exiting.
25f3d8
25f3d8
This is just a simple mistake @skef made.
25f3d8
---
25f3d8
 fontforge/sfd.c | 2 +-
25f3d8
 1 file changed, 1 insertion(+), 1 deletion(-)
25f3d8
25f3d8
diff --git a/fontforge/sfd.c b/fontforge/sfd.c
25f3d8
index e8ca39ba83..9517d8cb12 100644
25f3d8
--- a/fontforge/sfd.c
25f3d8
+++ b/fontforge/sfd.c
25f3d8
@@ -7998,9 +7998,9 @@ bool SFD_GetFontMetaData( FILE *sfd,
25f3d8
 	int layer_cnt_tmp;
25f3d8
 	getint(sfd,&layer_cnt_tmp);
25f3d8
 	if ( layer_cnt_tmp>2 ) {
25f3d8
+	    sf->layer_cnt = layer_cnt_tmp;
25f3d8
 	    sf->layers = realloc(sf->layers,sf->layer_cnt*sizeof(LayerInfo));
25f3d8
 	    memset(sf->layers+2,0,(sf->layer_cnt-2)*sizeof(LayerInfo));
25f3d8
-	    sf->layer_cnt = layer_cnt_tmp;
25f3d8
 	}
25f3d8
     }
25f3d8
     else if ( strmatch(tok,"Layer:")==0 )