This is an archive of the discontinued LLVM Phabricator instance.

[clang][analyzer] No end-of-file when seek to file begin.
ClosedPublic

Authored by balazske on Jun 20 2023, 8:47 AM.

Details

Summary

If fseek is used with 0 position and SEEK_SET it sets the position
to the start of the file. This should not cause FEOF (end of file) error.
The case of an empty file is not handled for simplification.
It is not exactly defined in what cases fseek produces the different
error states. Normally feof should not happen at all because it is
possible to set the position after the end of file, but previous tests
showed that still feof (and any other error cases) can happen.

Diff Detail

Event Timeline

balazske created this revision.Jun 20 2023, 8:47 AM
Herald added a reviewer: NoQ. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
balazske requested review of this revision.Jun 20 2023, 8:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2023, 8:47 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This case is an example of what can be fixed by the change.

This revision is now accepted and ready to land.Jun 29 2023, 6:10 AM