Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, Simon Marchi <simon.marchi@efficios.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] gdb: fix out-of-bounds span in append_composite_type_field_raw
Date: Sat, 21 Nov 2026 00:09:58 -0500	[thread overview]
Message-ID: <2ad6424e-4ad0-4a3d-9d9a-8c5eff3a9fb0@simark.ca> (raw)
In-Reply-To: <87h5hbxkns.fsf@tromey.com>

On 11/20/26 4:22 PM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
> 
> Simon> Fix it by reallocating the array before incrementing the number of
> Simon> fields.
> 
> Thanks.
> 
> Simon> There are more such existing problems uncovered when using std::span,
> Simon> but this is the most obvious and blocking one.
> 
> Ugh, sorry.  I will try to get to fixing these.

No worries.  Not your fault in either case.

Here are two I know:

  $ make check TESTS="gdb.base/gcore.exp"

  (gdb) core /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/gcore/gcore.test
  [New LWP 3444629 (id 1)]
  /usr/include/c++/16/span:186:
  In function:
      constexpr std::span<_Type, _Extent>::span(_It, size_type) [with _It =
      const unsigned char*; _Type = const unsigned char; long unsigned int
      _Extent = 18446744073709551615; size_type = long unsigned int]

  Error: function requires a valid iterator range [first, first + count).

and

  $ make check TESTS="gdb.dwarf2/bitfield-parent-optimized-out.exp"

  p var.bitfield
  /usr/include/c++/16/span:186:
  In function:
      constexpr std::span<_Type, _Extent>::span(_It, size_type) [with _It =
      unsigned char*; _Type = unsigned char; long unsigned int _Extent =
      18446744073709551615; size_type = long unsigned int]

  Error: function requires a valid iterator range [first, first + count).

Ideally we would also improve gdb::span's asserts to match std::span's
asserts.

> Approved-By: Tom Tromey <tom@tromey.com>

Pushed both, thanks.

Simon

  reply	other threads:[~2026-11-21  5:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 20:15 [PATCH 1/2] gdb/unittests: skip mixed constness span tests with libstdc++ debug mode Simon Marchi
2026-11-20 20:15 ` [PATCH 2/2] gdb: fix out-of-bounds span in append_composite_type_field_raw Simon Marchi
2026-11-20 21:22   ` Tom Tromey
2026-11-21  5:09     ` Simon Marchi [this message]
2026-11-20 21:22 ` [PATCH 1/2] gdb/unittests: skip mixed constness span tests with libstdc++ debug mode Tom Tromey
2026-11-21 20:32 ` Andrew Burgess
2026-11-23 15:12   ` Simon Marchi

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=2ad6424e-4ad0-4a3d-9d9a-8c5eff3a9fb0@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    --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