[Analyzer][StreamChecker] Added check for "indeterminate file position".
authorBalázs Kéri <1.int32@gmail.com>
Wed, 27 May 2020 14:23:42 +0000 (16:23 +0200)
committerBalázs Kéri <1.int32@gmail.com>
Thu, 28 May 2020 06:21:57 +0000 (08:21 +0200)
commit9081fa20991d101728434b354a96283b26495b71
treee8c95f593135013f3fa2b75aaf8c413316f0ba47
parentc4990a03c6c347df120c0dbf6039e900889c4a92
[Analyzer][StreamChecker] Added check for "indeterminate file position".

Summary:
According to the standard, after a `wread` or `fwrite` call the file position
becomes "indeterminate". It is assumable that a next read or write causes
undefined behavior, so a (fatal error) warning is added for this case.
The indeterminate position can be cleared by some operations, for example
`fseek` or `freopen`, not with `clearerr`.

Reviewers: Szelethus, baloghadamsoftware, martong, NoQ, xazax.hun, dcoughlin

Reviewed By: Szelethus

Subscribers: rnkovacs, NoQ, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80018
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
clang/test/Analysis/stream-error.c