Forráskód Böngészése

Fix null pointer dereference

When looking up translated font names within font files, it was not
checking for null on the 'charset' variable (the translation character
set wasn't added/availble).
jp9000 11 éve
szülő
commit
cf1b106a26
1 módosított fájl, 10 hozzáadás és 0 törlés
  1. 10 0
      plugins/text-freetype2/find-font-iconv.c

+ 10 - 0
plugins/text-freetype2/find-font-iconv.c

@@ -127,6 +127,16 @@ char *sfnt_name_to_utf8(FT_SfntName *sfnt_name)
 	char *conv_in, *conv_out;
 	size_t in_len, out_len;
 
+	if (!charset) {
+		blog(LOG_DEBUG, "invalid character set found, "
+		                "platform_id: %d, encoding_id: %d, "
+		                "language_id: %d",
+		                sfnt_name->platform_id,
+		                sfnt_name->encoding_id,
+		                sfnt_name->language_id);
+		return NULL;
+	}
+
 	iconv_t ic = iconv_open("UTF-8", charset);
 	if (ic == (iconv_t)-1) {
 		blog(LOG_WARNING, "couldn't intialize font code page "