public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: stevemw@place.org
To: libstdc++-gnats@sourceware.cygnus.com
Subject: libstdc++/1853: <deque> deallocates unowned memory within .pop_back()
Date: Sun, 01 Apr 2001 00:00:00 -0000	[thread overview]
Message-ID: <20000201060801.27564.qmail@sourceware.cygnus.com> (raw)

>Number:         1853
>Category:       libstdc++
>Synopsis:       <deque> deallocates unowned memory within .pop_back()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 03 09:26:04 PST 2001
>Closed-Date:    
>Last-Modified:  
>Originator:     Stephen M Wynne
>Release:        libstdc++-2.9.0-24
>Organization:
>Environment:
Intel RedHat 6.1
>Description:
Coredumps occur after doing a D.pop_back() on an
empty object (declared by deque<int> D;).

After quickly reading it, I can only surmize that
stl_deque.h's class deque's pop_back() mutator
properly doesn't check to see if the object is empty.
(I didn't fully understand pop_back_aux(), but it may
be pointless to go into that function if we're empty.)

Note: I did a search for pop on libstdc++ and didn't
see a report for this bug. I think it's a major one,
so I hope we can fix it soon. Thanks for the work!
>How-To-Repeat:
int main() {
    deque<int> v;
 
    v.pop_back();
    v.push_back(1);
    return 0;
}
>Fix:
Add a check inside push_back() 
(before it does anything else) as follows:

if (finish == start) return;
>Release-Note:
>Audit-Trail:

Formerly PR libstdc++/31

>Unformatted:


             reply	other threads:[~2001-04-01  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-01  0:00 stevemw [this message]
2001-06-12 14:14 bkoz
2001-12-28 15:51 pme
2002-01-02 21:00 pme

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=20000201060801.27564.qmail@sourceware.cygnus.com \
    --to=stevemw@place.org \
    --cc=libstdc++-gnats@sourceware.cygnus.com \
    /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).