[LLVMbugs] [Bug 18786] New: Iterator overrun in std::unique
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Feb 9 08:52:25 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18786
Bug ID: 18786
Summary: Iterator overrun in std::unique
Product: libc++
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: hhinnant at apple.com
Reporter: eric at boostpro.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Hi Howard. Forgive me, maybe this is just because I haven't had my morning
coffee yet, but I'm looking at the implementation of std::unique, and I see
this:
if (__first != __last)
{
// ... a a ? ...
// f i
_ForwardIterator __i = __first;
for (++__i; ++__i != __last;)
if (!__pred(*__first, *__i))
*++__first = _VSTD::move(*__i);
++__first;
}
Now image __first and __last delimit a sequence of exactly one element. __first
!= __last is true, __i is assigned begin, is incremented once (so now it equals
__last), and is then incremented *again* before comparing it to last. This
looks like a bug to me.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140209/1ec0c9c8/attachment.html>
More information about the llvm-bugs
mailing list