[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 134726] New: incorrect use of stl::map::erase(iterator p)
From:       "Stephen F.Booth" <me () sbooth ! org>
Date:       2006-09-27 4:25:29
Message-ID: 20060927062528.134726.me () sbooth ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=134726         
           Summary: incorrect use of stl::map::erase(iterator p)
           Product: taglib
           Version: unspecified
          Platform: Compiled Sources
        OS/Version: other
            Status: UNCONFIRMED
          Severity: crash
          Priority: NOR
         Component: general
        AssignedTo: wheeler kde org
        ReportedBy: me sbooth org


Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc version 4.0.1 (Apple Computer, Inc. build 5363) 
OS:                OS X

Line 137 of tmap.tcc is:
  d->map.erase(find(key));

this will cause a cause if find(key) returns an iterator of end().

Instead, the code snippet should resemble:

if(find(key) != d->map.end())
  d->map.erase(find(key));

to meet the precondition for erase() that p is dereferenceable.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic