eolian: prevent parsing when eo file version is too new
authorDaniel Kolesa <d.kolesa@samsung.com>
Sun, 26 May 2019 16:30:02 +0000 (18:30 +0200)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 30 May 2019 08:17:52 +0000 (17:17 +0900)
src/lib/eolian/Eolian.h
src/lib/eolian/eo_parser.c

index fdda984..a612f3a 100644 (file)
@@ -84,6 +84,9 @@ extern "C" {
 
 #ifdef EFL_BETA_API_SUPPORT
 
+/* The maximum format version supported by this version of Eolian */
+#define EOLIAN_FILE_FORMAT_VERSION 1
+
 /* State information
  *
  * Possible to cast to Eolian_Unit and use as such, as this represents
index 74c76d3..4fc14be 100644 (file)
@@ -2300,6 +2300,8 @@ parse_chunk(Eo_Lexer *ls, Eina_Bool eot)
                eo_lexer_syntax_error(ls, "#version too low");
 
              ls->unit->version = (unsigned short)(ls->t.value.u);
+             if (ls->unit->version > EOLIAN_FILE_FORMAT_VERSION)
+               eo_lexer_syntax_error(ls, "file version too new for this version of Eolian");
              eo_lexer_get(ls);
              break;
            }