I: [PATCH] strings section handling fix

Nick Clifton nickc@redhat.com
Tue Jul 5 11:45:00 GMT 2005


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().



More information about the Binutils mailing list