This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: fix latent bug in syms_from_objfile_1
- From: Tom Tromey <tromey at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 21 Mar 2013 09:30:48 -0600
- Subject: Re: RFC: fix latent bug in syms_from_objfile_1
- References: <87ip4m7wxy dot fsf at fleche dot redhat dot com> <20130320184034 dot GA708 at host2 dot jankratochvil dot net> <87ip4l7swd dot fsf at fleche dot redhat dot com> <20130321141954 dot GA10644 at host2 dot jankratochvil dot net>
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> On Wed, 20 Mar 2013 20:50:10 +0100, Tom Tromey wrote:
>> --- a/gdb/symfile.c
>> +++ b/gdb/symfile.c
Jan> [...]
>> @@ -205,11 +207,14 @@ alloc_section_addr_info (size_t num_sections)
>> struct section_addr_info *sap;
>> size_t size;
>>
>> + /* Make sure the size calculation turns out ok. */
>> + if (num_sections == 0)
>> + ++num_sections;
Jan> I always thought such sizeof calculation works even with # of
Jan> elements == 0. Why not?
It seemed weird to me since it would allocate an object smaller than a
struct section_addr_info.
I don't mind dropping that line though.
Jan> I am OK with the patch, thanks for the cleanup waiting for so many years.
Thanks. I'm going to put it in today, since it is actively messing up
my regression tests.
Tom