Commit a93b5e36 authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

fexc: More relaxed version data check in script_bin.c



Recent original .bin files showed up with a version[0] of 49152
= 0xC000, which won't pass our current sanity checks. Restrict
version[0] check to lower 14 bits, to make it pass again.

(This might require further investigation in the future, as it's
possible that this particular header field actually isn't related
to version data at all.)

Fixes #51.
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent 6271d370
...@@ -318,7 +318,7 @@ int script_decompile_bin(void *bin, size_t bin_size, ...@@ -318,7 +318,7 @@ int script_decompile_bin(void *bin, size_t bin_size,
unsigned int i; unsigned int i;
struct script_bin_head *head = bin; struct script_bin_head *head = bin;
if ((head->version[0] > SCRIPT_BIN_VERSION_LIMIT) || if (((head->version[0] & 0x3FFF) > SCRIPT_BIN_VERSION_LIMIT) ||
(head->version[1] > SCRIPT_BIN_VERSION_LIMIT) || (head->version[1] > SCRIPT_BIN_VERSION_LIMIT) ||
(head->version[2] > SCRIPT_BIN_VERSION_LIMIT)) { (head->version[2] > SCRIPT_BIN_VERSION_LIMIT)) {
pr_err("Malformed data: version %u.%u.%u.\n", pr_err("Malformed data: version %u.%u.%u.\n",
...@@ -333,7 +333,7 @@ int script_decompile_bin(void *bin, size_t bin_size, ...@@ -333,7 +333,7 @@ int script_decompile_bin(void *bin, size_t bin_size,
} }
pr_info("%s: version: %u.%u.%u\n", filename, pr_info("%s: version: %u.%u.%u\n", filename,
head->version[0], head->version[1], head->version[2]); head->version[0] & 0x3FFF, head->version[1], head->version[2]);
pr_info("%s: size: %zu (%u sections)\n", filename, pr_info("%s: size: %zu (%u sections)\n", filename,
bin_size, head->sections); bin_size, head->sections);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment