[llvm-bugs] [Bug 28331] New: Static analyzer false positive of Unix API violation: Improper use of 'open', when 'open is in an alternative namespace

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 27 08:12:12 PDT 2016


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

            Bug ID: 28331
           Summary: Static analyzer false positive of Unix API violation:
                    Improper use of 'open', when 'open is in an
                    alternative namespace
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: nega at icecube.umd.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16642
  --> https://llvm.org/bugs/attachment.cgi?id=16642&action=edit
sample code demonstrating Unix API violation false positive

When the function open() appears in an alternative namespace with an unusual
number of arguments, the static analyzer still reports it as a violation of the
standard Unix function open().

This behavior occurs in checker-278:
clang version 3.8.0 (tags/checker/checker-278)
Target: x86_64-apple-darwin15.2.0

Apple Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0

and Ubuntu 16.04 Clang:
clang version 3.8.0-2ubuntu3 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu

The attached code demonstrates this behavior with:
❯ clang++ --analyze main.cc        
main.cc:17:3: warning: Call to 'open' with more than three arguments
  outer::inner::open(ofs_, "foo");
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

-- 
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/20160627/56ecb824/attachment-0001.html>


More information about the llvm-bugs mailing list