public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: dje@watson.ibm.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/4428: libgcc (unwind-dw2-fde.c) uses signed arithmetic for address comparison
Date: Sun, 30 Sep 2001 12:56:00 -0000	[thread overview]
Message-ID: <20010930195209.4337.qmail@sourceware.cygnus.com> (raw)

>Number:         4428
>Category:       c++
>Synopsis:       libgcc (unwind-dw2-fde.c) uses signed arithmetic for address comparison
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 30 12:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     dje@watson.ibm.com
>Release:        gcc-3.0.x and gcc-3.1 (pre-release)
>Organization:
>Environment:
powerpc-ibm-aix4.3.3.0
>Description:
unwind-dw2-fde.c FDE comparison routines use signed
arithmetic on addresses.  This is invalid when addresses
may have their most significant bit set, making large
addresses and differences between those values to generate
results which appear to be negative.
>How-To-Repeat:
static saddr
fde_unencoded_compare (struct object *ob __attribute__((unused)),
                       fde *x, fde *y)
{
  return *(saddr *)x->pc_begin - *(saddr *)y->pc_begin;
}

Run till exit from #0  fde_unencoded_compare (ob=0x20000c40, x=0xf0105f8c,
    y=0x2000087c) at /usr/gnu/src/gcc-3.0/gcc/unwind-dw2-fde.c:298
0xd0b962ec in search_object (ob=0x20000c40, pc=0x1000036f)
    at /usr/gnu/src/gcc-3.0/gcc/unwind-dw2-fde.c:515
515                 i1--;
Value returned is $63 = -1061592376

(gdb) print/x 0xd0b96608 - 0x10000340
$138 = 0xc0b962c8
(gdb) print (int) 0xd0b96608 - 0x10000340
$139 = -1061592376
>Fix:
Do not use shortcut of signed integer comparison for
addresses.
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-09-30 12:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-30 12:56 dje [this message]
2002-03-18  7:58 jason

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=20010930195209.4337.qmail@sourceware.cygnus.com \
    --to=dje@watson.ibm.com \
    --cc=gcc-gnats@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: link
Be 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).