X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Fxcofflink.c;h=2560d2ca427ae5051868fb554b3b64502dd5c575;hb=7c1f42273567c30e17e1363897ce5c6d0764c643;hp=ff4b483703254ace62b2009dc45c6ab1a9849873;hpb=986f078366b193ed9f5bd02af965f3af958ba859;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index ff4b483703..2560d2ca42 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -1317,14 +1317,17 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) { bfd_byte *linenos; - amt = linesz * o->lineno_count; - linenos = bfd_malloc (amt); + if (bfd_seek (abfd, o->line_filepos, SEEK_SET) != 0) + goto error_return; + if (_bfd_mul_overflow (linesz, o->lineno_count, &amt)) + { + bfd_set_error (bfd_error_file_too_big); + goto error_return; + } + linenos = _bfd_malloc_and_read (abfd, amt, amt); if (linenos == NULL) goto error_return; reloc_info[o->target_index].linenos = linenos; - if (bfd_seek (abfd, o->line_filepos, SEEK_SET) != 0 - || bfd_bread (linenos, amt, abfd) != amt) - goto error_return; } }