tdata_type *tdata = abfd->tdata.any;
asymbol *symbols = NULL;
sec_ptr space_function_index;
+ size_t amt;
p = asect->contents;
end = asect->contents + asect->size;
if (!space_function_index)
return FALSE;
- symbols = bfd_alloc2 (abfd, tdata->symcount, sizeof (asymbol));
+ if (_bfd_mul_overflow (tdata->symcount, sizeof (asymbol), &amt))
+ {
+ bfd_set_error (bfd_error_file_too_big);
+ return FALSE;
+ }
+ symbols = bfd_alloc (abfd, amt);
if (!symbols)
return FALSE;
if (bfdsec->size != 0)
{
- bfdsec->contents = bfd_alloc (abfd, bfdsec->size);
+ bfdsec->contents = _bfd_alloc_and_read (abfd, bfdsec->size,
+ bfdsec->size);
if (!bfdsec->contents)
goto error_return;
-
- if (bfd_bread (bfdsec->contents, bfdsec->size, abfd) != bfdsec->size)
- goto error_return;
}
vma += bfdsec->size;
static asymbol *
wasm_make_empty_symbol (bfd *abfd)
{
- bfd_size_type amt = sizeof (asymbol);
+ size_t amt = sizeof (asymbol);
asymbol *new_symbol = (asymbol *) bfd_zalloc (abfd, amt);
if (! new_symbol)
/* Check whether ABFD is a WebAssembly module; if so, scan it. */
-static const bfd_target *
+static bfd_cleanup
wasm_object_p (bfd *abfd)
{
bfd_boolean error;
if (s != NULL && wasm_scan_name_function_section (abfd, s))
abfd->flags |= HAS_SYMS;
- return abfd->xvec;
+ return _bfd_no_cleanup;
}
/* BFD_JUMP_TABLE_WRITE */