[llvm-bugs] [Bug 25226] New: alpha.security.ReturnPtrRange false positives on iterator end() and rbegin()

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 17 05:18:53 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25226

            Bug ID: 25226
           Summary: alpha.security.ReturnPtrRange false positives on
                    iterator end() and rbegin()
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: gonzalobg88 at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This check produces a false positive on every `end()` member and non-member
function since the whole point of `end()` is to return an iterator to 1 past
the end. rbegin returns an iterator to one before begin, so this will also
probably fail.

The check maybe be modified to warn on:
- returning a pointer that points to 2 past the end, -2 past the beginning or
more since these cases are a mistake (this is obviously a mistake)
- warn only if this pointer is dereferenced somewhere

If the check cannot be modified to warn on these things maybe its existence
should be reconsidered, since the amount of false positives is just too high on
any codebase that uses iterators.

-- 
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/20151017/b011bb7d/attachment.html>


More information about the llvm-bugs mailing list