mirror of https://github.com/google/oss-fuzz.git
Update binutils/fuzz_as initialisation (#9400)
Upstream gas has changed, resulting in issues like https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=48997
This commit is contained in:
parent
cc655c2129
commit
db7354e3d3
|
@ -31,13 +31,17 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
reg_section = NULL;
|
||||
|
||||
const char *fakeArgv[3];
|
||||
fakeArgv[0] = "fuzz_objdump";
|
||||
fakeArgv[0] = "fuzz_as";
|
||||
fakeArgv[1] = filename; // Assemble our fake source file.
|
||||
fakeArgv[2] = NULL;
|
||||
|
||||
out_file_name = "/tmp/tmp-out";
|
||||
|
||||
// as initialition. This follows the flow of ordinary main function
|
||||
hex_init ();
|
||||
if (bfd_init () != BFD_INIT_MAGIC)
|
||||
abort ();
|
||||
obstack_begin (¬es, chunksize);
|
||||
symbol_begin ();
|
||||
frag_init ();
|
||||
subsegs_begin ();
|
||||
|
@ -47,21 +51,25 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||
macro_init (flag_macro_alternate, flag_mri, 0, macro_expr);
|
||||
|
||||
output_file_create (out_file_name);
|
||||
dot_symbol_init ();
|
||||
itbl_init ();
|
||||
dwarf2_init ();
|
||||
cond_finish_check (-1);
|
||||
|
||||
dot_symbol_init ();
|
||||
local_symbol_make (".gasversion.", absolute_section,
|
||||
&predefined_address_frag, BFD_VERSION / 10000UL);
|
||||
|
||||
// Main fuzzer target. Assemble our random data.
|
||||
perform_an_assembly_pass (2, (char**)fakeArgv);
|
||||
|
||||
// Cleanup
|
||||
cond_finish_check (-1);
|
||||
codeview_finish ();
|
||||
dwarf2_finish ();
|
||||
cfi_finish ();
|
||||
input_scrub_end ();
|
||||
|
||||
keep_it = 0;
|
||||
output_file_close ();
|
||||
free_notes ();
|
||||
unlink(filename);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue