fuzz_objcopy.c calls copy_main that calls getopt. Without
reinitialisation of optind, this means that of the 100 iterations per
sample only the first would see the fake command line options. And if
another sample was then tested in the same running process, no iteration
would see the command line options. Fix this by setting optind. Do so
every second iteration because it's usefull to test with default options
too.
fuzz_addr2line set up five command line addresses but then only used
two. Fix that too, and use xmalloc/xstrdup so that malloc fails are
fatal.
This should fix issue 49000, caused by not freeing symbol htabs. The
patch also removes some NULLing out of buffer pointers. These are all
cleared in init_objcopy_global_state.
bfd_init doesn't do much at the moment, but I'm planning on changing it
to re-initialise static state, with the aim of getting rid of some of
the flaky crashes reported by oss-fuzz.
Improve binutils fuzzing in three ways:
- Extend objdump and objcopy fuzzers. Make a version of objdump fuzzing
that is more stable
- New targetted disassembly fuzzer for mep architecture
- Include more extensive corpus
Signed-off-by: David Korczynski <david@adalogics.com>