From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>, Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix buffer overflow in ada-lang.c:move_bits
Date: Thu, 08 Nov 2018 19:12:00 -0000 [thread overview]
Message-ID: <609409e6-235a-4724-3ced-57c3ff42e299@redhat.com> (raw)
In-Reply-To: <082f66ea-223b-52f4-bc24-b274dbcf4f01@redhat.com>
On 11/08/2018 07:11 PM, Pedro Alves wrote:
> On 11/01/2018 03:35 PM, Joel Brobecker wrote:
>> Hi Tom,
>>
>>> -fsanitize=address showed that ada-lang.c:move_bits can run off the
>>> end of the source buffer. I believe this patch fixes the problem, by
>>> arranging not to read from the source buffer once there are sufficient
>>> bits in the accumulator.
>>>
>>> gdb/ChangeLog
>>> 2018-10-23 Tom Tromey <tom@tromey.com>
>>>
>>> * ada-lang.c (move_bits): Don't run off the end of the source
>>> buffer.
>>
>> Thanks for the patch!
>>
>> This is a part of the code that always forces me to think twice
>> (or ten times), each time I try to touch it. I should really start
>> adding comments to this code that detail what we are trying to do
>> as we do it.
>>
>> I tested your change through our testsuite on the various baremetal
>> targets we have, and noticed that it causes regressions on ppc and arm
>> targets. It's hopefully something small, but just being back from
>> a holiday, I'm a bit tied up at work; I'll put that issue on my TODO
>> list to look at further.
>
> I was going to suggest that this would benefit from unit tests in
> the style of dwarf2read.c:copy_bitwise's, but, actually, isn't this
> exactly the same as copy_bitwise? Can we get rid of ada-lang.c:move_bits?
> (And maybe move copy_bitwise elsewhere?)
I meant to say dwarf2loc.c instead of dwarf2read.c.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2018-11-08 19:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 16:21 Tom Tromey
2018-11-01 15:35 ` Joel Brobecker
2018-11-01 22:16 ` Tom Tromey
2018-11-08 19:11 ` Pedro Alves
2018-11-08 19:12 ` Pedro Alves [this message]
2018-11-09 17:16 ` Joel Brobecker
2018-11-14 17:11 ` Joel Brobecker
2018-11-14 17:23 ` Pedro Alves
2018-11-14 23:17 ` Joel Brobecker
2018-11-15 0:02 ` [RFA] Move copy_bitwise unittests to own unittest file (was: "Re: [PATCH] Fix buffer overflow in ada-lang.c:move_bits") Joel Brobecker
2018-11-15 10:59 ` [RFA] Move copy_bitwise unittests to own unittest file Pedro Alves
2018-11-15 15:56 ` pushed: " Joel Brobecker
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=609409e6-235a-4724-3ced-57c3ff42e299@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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