]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/elf32-rl78.c
_bfd_mul_overflow
[thirdparty/binutils-gdb.git] / bfd / elf32-rl78.c
index b7e3464c6f1e43293db7a728d5e57ce97ddff03a..f4abf0425e8f55a7fd0300a594f9edefc76416fa 100644 (file)
@@ -2121,10 +2121,14 @@ rl78_elf_relax_section
 
   if (shndx_hdr && shndx_hdr->sh_size != 0)
     {
-      bfd_size_type amt;
+      size_t amt;
 
-      amt = symtab_hdr->sh_info;
-      amt *= sizeof (Elf_External_Sym_Shndx);
+      if (_bfd_mul_overflow (symtab_hdr->sh_info,
+                            sizeof (Elf_External_Sym_Shndx), &amt))
+       {
+         bfd_set_error (bfd_error_no_memory);
+         goto error_return;
+       }
       shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
       if (shndx_buf == NULL)
        goto error_return;