浏览代码

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 年之前
父节点
当前提交
cf1b106a26
共有 1 个文件被更改,包括 10 次插入0 次删除
  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 "