From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ACDF33858C27; Tue, 31 Oct 2023 12:05:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACDF33858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698753943; bh=hnh5TyD/8/9Nlco3xwRZo7nGgNmRx8mMC8vzyHvj3yA=; h=From:To:Subject:Date:From; b=NnuTRQYz6QkiYSZP8rEFMR/9w3qxv+SvgIW7HJtNe+mGR/+hCP7Zj2SK3vrGcLgme GUpQPZf6s1pGBqqM0QoTgZM0uwzHaFjQdLnOWKLtQybeUwYjRdp58argrqmi+NNHql ndEAew3PErXva9AnjecR27u88RrO62BSHPCfJjZQ= From: "jdapena at igalia dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/112314] New: Missing index assertions in basic_string_view Date: Tue, 31 Oct 2023 12:05:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jdapena at igalia dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112314 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=3D1, that i= nclude 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 ind= ex provided is valid. Another failing test is: int length =3D -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.=