public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/112314] New: Missing index assertions in basic_string_view
@ 2023-10-31 12:05 jdapena at igalia dot com
  2023-10-31 15:28 ` [Bug libstdc++/112314] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jdapena at igalia dot com @ 2023-10-31 12:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112314
           Summary: Missing index assertions in basic_string_view
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jdapena at igalia dot com
  Target Milestone: ---

While testing Chromium base unit tests with _GLIBCXX_ASSERTIONS=1, that include
checks for base::StringPiece, that wraps nowadays std::string_view, two unit
tests are failing because they are expected to assert and they don't.

One failing tests is:
  {
    StringPiece piece;
    ASSERT_DEATH_IF_SUPPORTED(piece.remove_suffix(1), "");
  }

In this case, std::basic_string_view::remove_suffix should check if the index
provided is valid.

Another failing test is:

  int length = -1;
  ASSERT_DEATH_IF_SUPPORTED({ StringPiece piece("hello", length); }, "");

In this case, std::basic_string_view::basic_string_view(const _CharT* __str,
size_type __len) is not validating that __len is a valid index for __str.

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

end of thread, other threads:[~2023-12-06 21:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-31 12:05 [Bug libstdc++/112314] New: Missing index assertions in basic_string_view jdapena at igalia dot com
2023-10-31 15:28 ` [Bug libstdc++/112314] " redi at gcc dot gnu.org
2023-11-02  8:47 ` jdapena at igalia dot com
2023-11-02 14:54 ` cvs-commit at gcc dot gnu.org
2023-11-02 16:06 ` redi at gcc dot gnu.org
2023-11-02 16:19 ` jdapena at igalia dot com
2023-11-02 17:37 ` redi at gcc dot gnu.org
2023-11-02 17:40 ` redi at gcc dot gnu.org
2023-11-08 13:18 ` cvs-commit at gcc dot gnu.org
2023-12-06 16:35 ` cvs-commit at gcc dot gnu.org
2023-12-06 21:01 ` cvs-commit 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).