9 Commits

Author SHA1 Message Date
Bernhard Nortmann
2a4af4f5f2 fexc: Convert version[0] header field to filesize
Vendor-provided .bin files have repeatedly demonstrated that our
previous interpretation of this field as version[0] is likely
wrong. Instead, it seems to represent the file size (in bytes)
of the .bin file.

This commit fixes both decompilation (and header checks) and
generation of .bin files, where it will now store the size to
this field.

TODO: It's unclear whether the 'filesize' needs some specific
alignment (and the .bin corresponding padding). A value of
34864 (0x8830) has already been observed, so any possible
alignment is expected not to exceed 16 bytes (0x10). (Currently
our .bin generator doesn't care about any specific alignment.)

Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
2016-11-10 13:59:43 +01:00
Bernhard Nortmann
ef545814de fexc: Improve script_decompile_bin() safeguards
When declaring 'signed' values for section count and version
information in the script_bin_head structure, testing them to be
below certain thresholds (SCRIPT_BIN_*_LIMIT) is insufficient;
as 'negative' values like in "fexc-bin: script.bin: version:
-404840454.-1074397186.-1073906177" would still pass.

Fix this by making these member fields unsigned.

Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
2016-04-20 09:29:50 +02:00
Alejandro Mery
79ea14d4e0 Relicensed as GPLv2+ 2012-06-15 22:34:22 +02:00
Alejandro Mery
3cabfc519b script_bin: fix typo 2012-06-14 10:14:00 +02:00
Alejandro Mery
a14b0a7aa8 script_bin: move bin structs from script.h to script_bin.h 2012-05-11 16:20:48 +02:00
Alejandro Mery
73b18fcfc9 fexc: move bin2fex's main() in 2012-05-11 12:02:10 +02:00
Alejandro Mery
02a8f0abd2 fexc: use script_bin.o 2012-05-11 10:34:51 +02:00
Alejandro Mery
919237127d fex2bin: call generate_bin() and write data out on success 2012-05-07 10:25:24 +02:00
Alejandro Mery
049f0daf13 fex2bin: refactored generate_bin() as calculate_bin_size() into script_bin.c 2012-05-07 09:39:02 +02:00