This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: I: [PATCH] strings section handling fix


Hi Dmitry,

The strings utility may mishandle a file if it finds a section with
enormously large size.  In this case, strings attempts to allocate
memory and dies due to OOM.

Original bugreport and test cases could be found at
https://bugzilla.altlinux.org/show_bug.cgi?id=5871

Proposed fix is attached.

Thanks - I have applied your patch with a few small tweaks to make it more self-documenting.


Cheers
  Nick

binutils/ChangeLog
2005-07-05  Dmitry V. Levin  <ldv@altlinux.org>
	    Nick Clifton  <nickc@redhat.com>

	* strings.c (filename_and_size_t): New typedef.
	(strings_a_section): Skip sections with size greater or equal to
	the file size.  Cache the file size to avoid repeated stat()s.
	(strings_object_file): Pass filename_and_size_t argument to
	strings_a_section() via bfd_map_over_sections().


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]