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 <bernhard.nortmann@web.de>
This commit is contained in:
Bernhard Nortmann 2016-05-26 07:46:58 +02:00
parent a93b5e3636
commit 80aae9268a

View File

@ -17,6 +17,7 @@
#include "common.h"
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
@ -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;