Add codes to avoid parse non-xml file 68/266368/3
authorwn.jang <wn.jang@samsung.com>
Thu, 11 Nov 2021 06:00:29 +0000 (15:00 +0900)
committerwn.jang <wn.jang@samsung.com>
Thu, 11 Nov 2021 06:02:17 +0000 (15:02 +0900)
Change-Id: I25d1f7c13013ed9b9a7ea499709c35d29d715df9

common/tts_config_parser.c

index 09159ad..2c1e7b1 100644 (file)
@@ -58,6 +58,13 @@ int tts_parser_get_engine_info(const char* path, tts_engine_info_s** engine_info
                return -1;
        }
 
+       // Avoid to parse non-xml file
+       char* file_ext = strrchr(path, '.');
+       if (NULL == ++file_ext || (file_ext && 0 != strncmp("xml", file_ext, strlen(file_ext)))) {
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] File extention is not XML type, file_ext(%s)", (file_ext) ? file_ext : "NULL");
+               return -1;
+       }
+
        bool isTextsize = false;
        xmlDocPtr doc = NULL;
        xmlNodePtr cur = NULL;