[Fontconfig] fontconfig: Branch 'master' - 2 commits

Akira TAGOH tagoh at kemper.freedesktop.org
Fri May 25 05:03:35 UTC 2018


 src/fcmatch.c |    9 ++++-----
 src/fcxml.c   |    9 +++++++++
 2 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 94080c3d48686117b83acddf516258647b571f03
Author: Akira TAGOH <akira at tagoh.org>
Date:   Fri May 25 14:02:58 2018 +0900

    Fix -Wstringop-truncation warning

diff --git a/src/fcmatch.c b/src/fcmatch.c
index 62f8e58..cfb278a 100644
--- a/src/fcmatch.c
+++ b/src/fcmatch.c
@@ -841,15 +841,14 @@ FcFontSetMatchInternal (FcFontSet   **sets,
 		if (!(p = strchr (s, ',')))
 		{
 		    f = FcFalse;
-		    len = strlen (s) + 1;
+		    len = strlen (s);
 		}
 		else
 		{
-		    len = (p - s) + 1;
+		    len = (p - s);
 		}
-		x = malloc (sizeof (char) * len);
-		strncpy (x, s, len - 1);
-		x[len - 1] = 0;
+		x = malloc (sizeof (char) * (len + 1));
+		strcpy (x, s);
 		if (FcObjectFromName (x) > 0)
 		    FcObjectSetAdd (os, x);
 		s = p + 1;
commit 684c3ce6850c4168e127ea84432e7a9006296ff4
Author: Akira TAGOH <akira at tagoh.org>
Date:   Fri May 25 13:51:10 2018 +0900

    Fix leaks

diff --git a/src/fcxml.c b/src/fcxml.c
index 1ee1ba1..c69ee50 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -2777,6 +2777,11 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
 	    {
 		FcConfigMessage (parse, FcSevereError, "out of memory");
 	    }
+	    else
+	    {
+		if (parse->scanOnly && vstack->u.string)
+		    FcStrFree (vstack->u.string);
+	    }
 	    break;
 	case FcVStackPattern:
 	    if (!parse->scanOnly && !FcConfigPatternsAdd (parse->config,
@@ -2786,7 +2791,11 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
 		FcConfigMessage (parse, FcSevereError, "out of memory");
 	    }
 	    else
+	    {
+		if (parse->scanOnly && vstack->u.pattern)
+		    FcPatternDestroy (vstack->u.pattern);
 		vstack->tag = FcVStackNone;
+	    }
 	    break;
 	default:
 	    FcConfigMessage (parse, FcSevereWarning, "bad font selector");


More information about the Fontconfig mailing list