From 85880250e591a51624d24db653aaace0c5ce5943 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 6 Jan 2015 16:06:45 +0000 Subject: Fixes for memory access violations in the coffdump program. PR binutils/17512 * coffdump.c (dump_coff_section): Check for a symbol being available before printing its name. (main): Check the return value from coff_grok. * coffgrok.c: Reformat and tidy. Add range checks to most functions. (coff_grok): Return NULL if the input bfd is not in a COFF format. * coffgrok.h: Reformat and tidy. (struct coff_section): Change the nrelocs field to unsigned. * srconv.c (main): Check the return value from coff_grok. * coff-i860.c (CALC_ADDEND): Always set an addend value. * tekhex.c (getvalue): Add an end pointer parameter. Use it to avoid reading off the end of the buffer. (getsym): Likewise. (first_phase): Likewise. (pass_over): Pass an end pointer to the invoked function. --- binutils/srconv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'binutils/srconv.c') diff --git a/binutils/srconv.c b/binutils/srconv.c index 3762a25..d2e0cdb 100644 --- a/binutils/srconv.c +++ b/binutils/srconv.c @@ -1883,10 +1883,12 @@ main (int ac, char **av) printf ("ids %d %d\n", base1, base2); tree = coff_grok (abfd); + if (tree) + { + if (!noprescan) + prescan (tree); - if (!noprescan) - prescan (tree); - - wr_module (tree); + wr_module (tree); + } return 0; } -- cgit v1.1