Skip to content
Snippets Groups Projects
  • Marek Polacek's avatar
    b906f4ca
    Implement -fsanitize=vla-bound. · b906f4ca
    Marek Polacek authored
    	* opts.c (common_handle_option): Handle vla-bound.
    	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_VLA_BOUND_NOT_POSITIVE):
    	Define.
    	* flag-types.h (enum sanitize_code): Add SANITIZE_VLA.
    	* asan.c (initialize_sanitizer_builtins): Build BT_FN_VOID_PTR_PTR.
    c-family/
    	* c-ubsan.c: Don't include hash-table.h.
    	(ubsan_instrument_vla): New function.
    	* c-ubsan.h: Declare it.
    cp/
    	* decl.c (cp_finish_decl): Move C++1y bounds checking...
    	(compute_array_index_type): ...here.  Add VLA instrumentation.
    	Call stabilize_vla_size.
    	(grokdeclarator): Don't call stabilize_vla_size here.
    c/
    	* c-decl.c (grokdeclarator): Add VLA instrumentation.
    testsuite/
    	* g++.dg/ubsan/cxx1y-vla.C: New test.
    	* c-c++-common/ubsan/vla-3.c: New test.
    	* c-c++-common/ubsan/vla-2.c: New test.
    	* c-c++-common/ubsan/vla-4.c: New test.
    	* c-c++-common/ubsan/vla-1.c: New test.
    
    From-SVN: r204334
    b906f4ca
    History
    Implement -fsanitize=vla-bound.
    Marek Polacek authored
    	* opts.c (common_handle_option): Handle vla-bound.
    	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_VLA_BOUND_NOT_POSITIVE):
    	Define.
    	* flag-types.h (enum sanitize_code): Add SANITIZE_VLA.
    	* asan.c (initialize_sanitizer_builtins): Build BT_FN_VOID_PTR_PTR.
    c-family/
    	* c-ubsan.c: Don't include hash-table.h.
    	(ubsan_instrument_vla): New function.
    	* c-ubsan.h: Declare it.
    cp/
    	* decl.c (cp_finish_decl): Move C++1y bounds checking...
    	(compute_array_index_type): ...here.  Add VLA instrumentation.
    	Call stabilize_vla_size.
    	(grokdeclarator): Don't call stabilize_vla_size here.
    c/
    	* c-decl.c (grokdeclarator): Add VLA instrumentation.
    testsuite/
    	* g++.dg/ubsan/cxx1y-vla.C: New test.
    	* c-c++-common/ubsan/vla-3.c: New test.
    	* c-c++-common/ubsan/vla-2.c: New test.
    	* c-c++-common/ubsan/vla-4.c: New test.
    	* c-c++-common/ubsan/vla-1.c: New test.
    
    From-SVN: r204334