This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: I: [PATCH] strings section handling fix
- From: Nick Clifton <nickc at redhat dot com>
- To: "Dmitry V. Levin" <ldv at altlinux dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 05 Jul 2005 12:48:56 +0100
- Subject: Re: I: [PATCH] strings section handling fix
- References: <20050529113200.GA7639@nomad.office.altlinux.org>
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().