summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-05-26 18:30:02 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-05-26 18:30:02 +0200
commit21790b055b37fb8949d33d60ebec9bb5d800a633 (patch)
treef81f6c053251b98ad0716289575dd0e651c8c16e
parentb4dd54617f2bf81bfd20feec6f33061fe589eeff (diff)
eolian: prevent parsing when eo file version is too new
-rw-r--r--src/lib/eolian/Eolian.h3
-rw-r--r--src/lib/eolian/eo_parser.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index fdda984aef..a612f3af1c 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -84,6 +84,9 @@ extern "C" {
84 84
85#ifdef EFL_BETA_API_SUPPORT 85#ifdef EFL_BETA_API_SUPPORT
86 86
87/* The maximum format version supported by this version of Eolian */
88#define EOLIAN_FILE_FORMAT_VERSION 1
89
87/* State information 90/* State information
88 * 91 *
89 * Possible to cast to Eolian_Unit and use as such, as this represents 92 * Possible to cast to Eolian_Unit and use as such, as this represents
diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index 74c76d3a7d..4fc14be886 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -2300,6 +2300,8 @@ parse_chunk(Eo_Lexer *ls, Eina_Bool eot)
2300 eo_lexer_syntax_error(ls, "#version too low"); 2300 eo_lexer_syntax_error(ls, "#version too low");
2301 2301
2302 ls->unit->version = (unsigned short)(ls->t.value.u); 2302 ls->unit->version = (unsigned short)(ls->t.value.u);
2303 if (ls->unit->version > EOLIAN_FILE_FORMAT_VERSION)
2304 eo_lexer_syntax_error(ls, "file version too new for this version of Eolian");
2303 eo_lexer_get(ls); 2305 eo_lexer_get(ls);
2304 break; 2306 break;
2305 } 2307 }