-
- Downloads
analyzer: check format strings for null termination [PR105899]
This patch extends -fanalyzer to check the format strings of calls
to functions marked with '__attribute__ ((format...))'.
The only checking done in this patch is to check that the format string
is a valid null-terminated string; this patch doesn't attempt to check
the content of the format string.
gcc/analyzer/ChangeLog:
PR analyzer/105899
* call-details.cc (call_details::call_details): New ctor.
* call-details.h (call_details::call_details): New ctor decl.
(struct call_arg_details): Move here from region-model.cc.
* region-model.cc (region_model::check_call_format_attr): New.
(region_model::check_call_args): Call it.
(struct call_arg_details): Move it to call-details.h.
* region-model.h (region_model::check_call_format_attr): New decl.
gcc/testsuite/ChangeLog:
PR analyzer/105899
* gcc.dg/analyzer/attr-format-1.c: New test.
* gcc.dg/analyzer/sprintf-1.c: Update expected results for
now-passing tests.
Signed-off-by:
David Malcolm <dmalcolm@redhat.com>
Showing
- gcc/analyzer/call-details.cc 10 additions, 0 deletionsgcc/analyzer/call-details.cc
- gcc/analyzer/call-details.h 30 additions, 0 deletionsgcc/analyzer/call-details.h
- gcc/analyzer/region-model.cc 95 additions, 30 deletionsgcc/analyzer/region-model.cc
- gcc/analyzer/region-model.h 2 additions, 0 deletionsgcc/analyzer/region-model.h
- gcc/testsuite/gcc.dg/analyzer/attr-format-1.c 31 additions, 0 deletionsgcc/testsuite/gcc.dg/analyzer/attr-format-1.c
- gcc/testsuite/gcc.dg/analyzer/sprintf-1.c 4 additions, 2 deletionsgcc/testsuite/gcc.dg/analyzer/sprintf-1.c
Loading
Please register or sign in to comment