Sanity of appending data to an executable binary
Is it generally sane to append some random data to an executable binary file? What measures should be taken to ensure safe operation of the resulting executable, like padding before appended data or whatever?
A typical C example would be:
gcc -o main.o -c main.c
gcc -o main main.o -lfoo
cat bar.txt >> main
The target system is broadly Uni开发者_Python百科x but a breakdown by system (Mac OS X, Linux, AIX...) is welcome if need be. A Windows point of view is welcome too for the sake of completeness.
This should be possible without issues, because in the ELF format the size of the program object should be specified and therefore only the data that should get loaded and executed gets loaded and executed.
精彩评论