From mboxrd@z Thu Jan 1 00:00:00 1970 From: stevemw@place.org To: libstdc++-gnats@sourceware.cygnus.com Subject: libstdc++/1853: deallocates unowned memory within .pop_back() Date: Sun, 01 Apr 2001 00:00:00 -0000 Message-id: <20000201060801.27564.qmail@sourceware.cygnus.com> X-SW-Source: 2001-q1/msg00893.html List-Id: >Number: 1853 >Category: libstdc++ >Synopsis: 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 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 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: