public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-7675] gccrs: Prevent invalid iterator dereference Date: Tue, 16 Jan 2024 17:52:45 +0000 (GMT) [thread overview] Message-ID: <20240116175245.E0D4F38582B5@sourceware.org> (raw) https://gcc.gnu.org/g:45c01fae2a2afb30b0ca933e9d7b807acb167d23 commit r14-7675-g45c01fae2a2afb30b0ca933e9d7b807acb167d23 Author: Owen Avery <powerboat9.gamer@gmail.com> Date: Sat Jun 17 00:32:38 2023 -0400 gccrs: Prevent invalid iterator dereference gcc/rust/ChangeLog: * lex/rust-lex.cc (Lexer::classify_keyword): Check if iterator is valid before dereferencing. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com> Diff: --- gcc/rust/lex/rust-lex.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc index c910c7cf83a..23579e51944 100644 --- a/gcc/rust/lex/rust-lex.cc +++ b/gcc/rust/lex/rust-lex.cc @@ -255,11 +255,12 @@ TokenId Lexer::classify_keyword (const std::string &str) { auto keyword = keywords.find (str); - auto id = keyword->second; if (keyword == keywords.end ()) return IDENTIFIER; + auto id = keyword->second; + // We now have the expected token ID of the reserved keyword. However, some // keywords are reserved starting in certain editions. For example, `try` is // only a reserved keyword in editions >=2018. The language might gain new
reply other threads:[~2024-01-16 17:52 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240116175245.E0D4F38582B5@sourceware.org \ --to=cohenarthur@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).