[Bug analyzer/106299] New: RFE: analyzer handling of fdopen

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 14 14:46:56 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106299

            Bug ID: 106299
           Summary: RFE: analyzer handling of fdopen
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
            Blocks: 106003
  Target Milestone: ---

Now that the analyzer supports checking both filedescriptor *and* FILE * usage,
we should probably add special-case handling of fdopen:

  https://www.man7.org/linux/man-pages/man3/fdopen.3p.html

I'm not quite sure how to model the interaction between the two state machines;
perhaps a successful fdopen on a fd should transition the fd from an open state
to the "stop" state (i.e. stop tracking state on this fd), and transition the
FILE * from the start state to the open state.

See also bug 101550, which has an example of using fdopen.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106003
[Bug 106003] RFE: -fanalyzer could complain about misuse of file-descriptors


More information about the Gcc-bugs mailing list