From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Denis Lukianov <denis@voxelsoft.com>, gdb-patches@sourceware.org
Cc: andrew.burgess@embecosm.com
Subject: Re: [PATCH] dwarf2: Fix dwarf stack fetch array view size mismatch
Date: Sun, 21 Aug 2022 10:17:05 -0400 [thread overview]
Message-ID: <a609bed8-2514-3f2e-f092-79854dc693e3@polymtl.ca> (raw)
In-Reply-To: <a9b7f220b820a81381fbaa221d98e9eefb4eda8b.camel@voxelsoft.com>
On 2022-08-19 21:55, Denis Lukianov wrote:
> On Sat, 2022-08-20 at 02:38 +0100, Denis Lukianov wrote:
>>
>> I know nothing about gdb internals, just reading code in the file:
>>
>> copy (value_contents_all (val).slice (subobj_offset, len),
>> value_contents_raw (retval));
>>
>> We know val is allocated to be the length of subobj_type.
>> We know retval is allocated to be the length of subobj_type.
>> We know len is the length of subobj_type.
>> We know slice only gives a view same size or smaller.
>>
>> So, the source array_view length must be len - subobj_offset.
>>
>> Therefore source array_view size will be of the length of subobj_type
>> and match the destination only in the event that subobj_offset
>> happens
>> to be zero. The line above does not guarantee it:
>>
>> subobj_offset += n - max;
>>
>> So it looks broken for big endian systems. And maybe any subtype that
>> is not the first element of a type on the others.
>>
>
> My bad, val is allocated to be length of type.
>
> So I'm wrong about all this and the code is fine :)
>
Ok, thanks for digging into it, the more eyes on the code the better.
Simon
prev parent reply other threads:[~2022-08-21 14:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 11:24 Denis Lukianov
2022-08-18 16:27 ` Simon Marchi via Gdb-patches
2022-08-19 21:33 ` Denis Lukianov
2022-08-20 0:55 ` Simon Marchi via Gdb-patches
2022-08-20 1:38 ` Denis Lukianov
2022-08-20 1:55 ` Denis Lukianov
2022-08-21 14:17 ` Simon Marchi via Gdb-patches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a609bed8-2514-3f2e-f092-79854dc693e3@polymtl.ca \
--to=gdb-patches@sourceware.org \
--cc=andrew.burgess@embecosm.com \
--cc=denis@voxelsoft.com \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox