[PATCH] D75045: [analyzer] Improved check of `fgetc` in StreamChecker.
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 24 05:28:44 PST 2020
balazske created this revision.
Herald added subscribers: cfe-commits, martong, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a reviewer: Szelethus.
Herald added a project: clang.
A warning is produced if the `getc` call fails (returns EOF) and
the next called stream function is not `feof` and `ferror`
(both are needed).
This check is inspired by CERT rule FIO34-C "Distinguish between characters read from a file and EOF or WEOF".
https://wiki.sei.cmu.edu/confluence/display/c/FIO34-C.+Distinguish+between+characters+read+from+a+file+and+EOF+or+WEOF
Other similar functions (and wide versions) are to be added.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75045
Files:
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
clang/test/Analysis/stream.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75045.246185.patch
Type: text/x-patch
Size: 14250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200224/be047538/attachment.bin>
More information about the cfe-commits
mailing list