From 80aae9268a05f6fe49d20ec8977f71ffe82ea0a2 Mon Sep 17 00:00:00 2001 From: Bernhard Nortmann Date: Thu, 26 May 2016 07:46:58 +0200 Subject: [PATCH] fexc: Warn when decompiling a malformed section entry (key string) script_bin.c decompiles section entries even if they have invalid indentifiers. Thus malformed .bin files were observed to result in a .fex that couldn't be processed successfully with the sunxi-fexc compiler. This patch makes bin2fex now issue a warning for this kind of keys, so that they're easier to notice and correct. Signed-off-by: Bernhard Nortmann --- script_bin.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/script_bin.c b/script_bin.c index 2d9874f..3315f67 100644 --- a/script_bin.c +++ b/script_bin.c @@ -17,6 +17,7 @@ #include "common.h" +#include #include #include #include @@ -240,6 +241,13 @@ static int decompile_section(void *bin, size_t bin_size, type = (entry->pattern >> 16) & 0xffff; words = (entry->pattern >> 0) & 0xffff; + for (char *p = entry->name; *p; p++) + if (!(isalnum(*p) || *p == '_')) { + pr_info("Warning: Malformed entry key \"%s\"\n", + entry->name); + break; + } + switch(type) { case SCRIPT_VALUE_TYPE_SINGLE_WORD: { uint32_t *v = data;