media-gfx/fontforge: fix misaligned memory access
authorMike Gilbert <floppym@gentoo.org>
Sat, 30 Dec 2017 22:45:38 +0000 (17:45 -0500)
committerMike Gilbert <floppym@gentoo.org>
Sat, 30 Dec 2017 22:46:03 +0000 (17:46 -0500)
Patch by Rolf Eike Beer.

Closes: https://bugs.gentoo.org/642756
Package-Manager: Portage-2.3.19_p3, Repoman-2.3.6_p37

media-gfx/fontforge/files/20170731-gethex-unaligned.patch [new file with mode: 0644]
media-gfx/fontforge/fontforge-20170731-r3.ebuild [moved from media-gfx/fontforge/fontforge-20170731-r2.ebuild with 98% similarity]

diff --git a/media-gfx/fontforge/files/20170731-gethex-unaligned.patch b/media-gfx/fontforge/files/20170731-gethex-unaligned.patch
new file mode 100644 (file)
index 0000000..812f7a4
--- /dev/null
@@ -0,0 +1,22 @@
+fix unaligned access in gethex()
+
+--- a/fontforge/sfd.c
++++ b/fontforge/sfd.c
+@@ -3393,6 +3393,7 @@
+ static int gethex(FILE *sfd, uint32 *val) {
+     char tokbuf[100]; int ch;
+     char *pt=tokbuf, *end = tokbuf+100-2;
++    uint32 u;
+ 
+     while ( isspace(ch = nlgetc(sfd)));
+     if ( ch=='#' )
+@@ -3416,7 +3417,8 @@
+     }
+     *pt='\0';
+     ungetc(ch,sfd);
+-    *val = strtoul(tokbuf,NULL,16);
++    u = strtoul(tokbuf,NULL,16);
++    memcpy(val, &u, sizeof(u));
+ return( pt!=tokbuf?1:ch==EOF?-1: 0 );
+ }
+ 
similarity index 98%
rename from media-gfx/fontforge/fontforge-20170731-r2.ebuild
rename to media-gfx/fontforge/fontforge-20170731-r3.ebuild
index c8ad245b14d7af5f3e159469b0a57bae0ebb7aa5..ae146eb064719e8103a6ac5e23e60feb9cdb5866 100644 (file)
@@ -65,6 +65,7 @@ S="${WORKDIR}/fontforge-2.0.${PV}"
 PATCHES=(
        "${FILESDIR}"/20170731-startnoui-FindOrMakeEncoding.patch
        "${FILESDIR}"/20170731-tilepath.patch
+       "${FILESDIR}"/20170731-gethex-unaligned.patch
 )
 
 pkg_setup() {