public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/28404] Verify bsearch precondition in find_pc_section Date: Fri, 01 Oct 2021 15:10:08 +0000 [thread overview] Message-ID: <bug-28404-4717-kuA5l0xsZq@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-28404-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=28404 --- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> --- I wrote this: ... diff --git a/gdb/objfiles.c b/gdb/objfiles.c index b65fa8820ca..cc9a47eaad8 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -1227,6 +1227,19 @@ find_pc_section (CORE_ADDR pc) return NULL; } + { + struct obj_section *prev_elem = nullptr; + struct obj_section *elem = nullptr; + for (int i = 0; i < pspace_info->num_sections; (prev_elem = elem), ++i) + { + elem = pspace_info->sections[i]; + gdb_assert (elem->addr () <= elem->endaddr ()); + if (prev_elem == nullptr) + continue; + gdb_assert (prev_elem->endaddr () <= elem->addr ()); + } + }re-- + sp = (struct obj_section **) bsearch (&pc, pspace_info->sections, pspace_info->num_sections, ... And tested using target board unix/-fPIE/-pie. No regression. So, I guess I was looking at the consequences of the patch series I was playing around with. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2021-10-01 15:10 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-01 9:25 [Bug gdb/28404] New: " vries at gcc dot gnu.org 2021-10-01 15:10 ` vries at gcc dot gnu.org [this message] 2021-10-01 15:13 ` [Bug gdb/28404] " vries at gcc dot gnu.org
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=bug-28404-4717-kuA5l0xsZq@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.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).