public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/98421] New: std::span does not detect invalid range in Debug Mode
@ 2020-12-22 15:50 redi at gcc dot gnu.org
  2021-08-31 16:35 ` [Bug libstdc++/98421] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2020-12-22 15:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98421

            Bug ID: 98421
           Summary: std::span does not detect invalid range in Debug Mode
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#define _GLIBCXX_DEBUG 1
#include <vector>
#include <span>

int main()
{
 std::vector<int> coll;
 coll.reserve(10);
 std::span first3{coll.begin(), 3}; // or coll.data(), 3
}

This should abort, because coll.begin()+3 is undefined, violating the
precondition of the std::span constructor.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/98421] std::span does not detect invalid range in Debug Mode
  2020-12-22 15:50 [Bug libstdc++/98421] New: std::span does not detect invalid range in Debug Mode redi at gcc dot gnu.org
@ 2021-08-31 16:35 ` redi at gcc dot gnu.org
  2021-08-31 18:14 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-31 16:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98421

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-31
             Status|UNCONFIRMED                 |ASSIGNED

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/98421] std::span does not detect invalid range in Debug Mode
  2020-12-22 15:50 [Bug libstdc++/98421] New: std::span does not detect invalid range in Debug Mode redi at gcc dot gnu.org
  2021-08-31 16:35 ` [Bug libstdc++/98421] " redi at gcc dot gnu.org
@ 2021-08-31 18:14 ` cvs-commit at gcc dot gnu.org
  2021-08-31 18:14 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-31 18:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98421

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:ef7becc9c8a48804d3fd9dac032f7b33e561a612

commit r12-3272-gef7becc9c8a48804d3fd9dac032f7b33e561a612
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 31 17:34:51 2021 +0100

    libstdc++: Add valid range checks to std::span constructors [PR98421]

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    libstdc++-v3/ChangeLog:

            PR libstdc++/98421
            * include/std/span (span(Iter, size_type), span(Iter, Iter)):
            Add valid range checks.
            * testsuite/23_containers/span/cons_1_assert_neg.cc: New test.
            * testsuite/23_containers/span/cons_2_assert_neg.cc: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/98421] std::span does not detect invalid range in Debug Mode
  2020-12-22 15:50 [Bug libstdc++/98421] New: std::span does not detect invalid range in Debug Mode redi at gcc dot gnu.org
  2021-08-31 16:35 ` [Bug libstdc++/98421] " redi at gcc dot gnu.org
  2021-08-31 18:14 ` cvs-commit at gcc dot gnu.org
@ 2021-08-31 18:14 ` redi at gcc dot gnu.org
  2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-31 18:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98421

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.0

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/98421] std::span does not detect invalid range in Debug Mode
  2020-12-22 15:50 [Bug libstdc++/98421] New: std::span does not detect invalid range in Debug Mode redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-08-31 18:14 ` redi at gcc dot gnu.org
@ 2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org
  2021-11-24 11:52 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-24 11:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98421

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:238fd13380838ad57d199f3e9ca1d5403f33d381

commit r11-9291-g238fd13380838ad57d199f3e9ca1d5403f33d381
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 31 17:34:51 2021 +0100

    libstdc++: Add valid range checks to std::span constructors [PR98421]

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    libstdc++-v3/ChangeLog:

            PR libstdc++/98421
            * include/std/span (span(Iter, size_type), span(Iter, Iter)):
            Add valid range checks.
            * testsuite/23_containers/span/cons_1_assert_neg.cc: New test.
            * testsuite/23_containers/span/cons_2_assert_neg.cc: New test.

    (cherry picked from commit ef7becc9c8a48804d3fd9dac032f7b33e561a612)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/98421] std::span does not detect invalid range in Debug Mode
  2020-12-22 15:50 [Bug libstdc++/98421] New: std::span does not detect invalid range in Debug Mode redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org
@ 2021-11-24 11:52 ` redi at gcc dot gnu.org
  2022-08-03 12:30 ` cvs-commit at gcc dot gnu.org
  2022-08-03 13:34 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-24 11:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98421

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.0                        |11.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/98421] std::span does not detect invalid range in Debug Mode
  2020-12-22 15:50 [Bug libstdc++/98421] New: std::span does not detect invalid range in Debug Mode redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-11-24 11:52 ` redi at gcc dot gnu.org
@ 2022-08-03 12:30 ` cvs-commit at gcc dot gnu.org
  2022-08-03 13:34 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-03 12:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98421

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:de802e4736613a585dcfd508acf73033f18aa4da

commit r10-10932-gde802e4736613a585dcfd508acf73033f18aa4da
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 31 17:34:51 2021 +0100

    libstdc++: Add valid range checks to std::span constructors [PR98421]

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    libstdc++-v3/ChangeLog:

            PR libstdc++/98421
            * include/std/span (span(Iter, size_type), span(Iter, Iter)):
            Add valid range checks.
            * testsuite/23_containers/span/cons_1_assert_neg.cc: New test.
            * testsuite/23_containers/span/cons_2_assert_neg.cc: New test.

    (cherry picked from commit ef7becc9c8a48804d3fd9dac032f7b33e561a612)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/98421] std::span does not detect invalid range in Debug Mode
  2020-12-22 15:50 [Bug libstdc++/98421] New: std::span does not detect invalid range in Debug Mode redi at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-08-03 12:30 ` cvs-commit at gcc dot gnu.org
@ 2022-08-03 13:34 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-03 13:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98421

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |10.5

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 11.3 and 10.5 too.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-03 13:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 15:50 [Bug libstdc++/98421] New: std::span does not detect invalid range in Debug Mode redi at gcc dot gnu.org
2021-08-31 16:35 ` [Bug libstdc++/98421] " redi at gcc dot gnu.org
2021-08-31 18:14 ` cvs-commit at gcc dot gnu.org
2021-08-31 18:14 ` redi at gcc dot gnu.org
2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org
2021-11-24 11:52 ` redi at gcc dot gnu.org
2022-08-03 12:30 ` cvs-commit at gcc dot gnu.org
2022-08-03 13:34 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).