Bug 179174 - [patch] flex(1) generated files trigger an alarm from clang static analyzer
Summary: [patch] flex(1) generated files trigger an alarm from clang static analyzer
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.1-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2013-06-01 17:00 UTC by Philippe Michel
Modified: 2021-01-16 20:54 UTC (History)
1 user (show)

See Also:

file.diff (341 bytes, patch)
2013-06-01 17:00 UTC, Philippe Michel
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Michel 2013-06-01 17:00:01 UTC
When compiled by clang static analyzer, C files generated by flex give the following alarm in yy_init_buffer() :

Access to field 'yy_input_file' results in a dereference of a null pointer (loaded from variable 'b')

Fix: This may be a false positive and clang may not analyze the code deeply enough to discover it, but checking variable 'b' and exiting with a managed fatal error instead of a core dump if it is null would avoid the problem with no functional side-effects, and would be even more useful if there is indeed a code path that could end with a null buffer.

Patch attached with submission follows:
How-To-Repeat: Compile a file generated by flex with ccc-analyzer (from ports' clang ; it is not installed with the base system compiler).
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:41 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped