Skip to content

Instantly share code, notes, and snippets.

@rubienr
Last active November 16, 2016 14:09
Show Gist options
  • Select an option

  • Save rubienr/ab40a347e3236a2844d918ad5828a6b8 to your computer and use it in GitHub Desktop.

Select an option

Save rubienr/ab40a347e3236a2844d918ad5828a6b8 to your computer and use it in GitHub Desktop.

Revisions

  1. rubienr revised this gist Nov 16, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion c-cpp-check-tools.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@
    * canary detection
    * gcc ... -fstack-protector -fstack-protector-all
    * gcc ... -fmudflap -fmudflapth -fmudflapir
    For front-ends that support it (C and C++), instrument all risky
    * For front-ends that support it (C and C++), instrument all risky
    pointer/array dereferencing operations, some standard library
    string/heap functions, and some other associated constructs with
    range/validity tests. Modules so instrumented should be immune to
  2. rubienr revised this gist Nov 16, 2016. 1 changed file with 6 additions and 7 deletions.
    13 changes: 6 additions & 7 deletions c-cpp-check-tools.md
    Original file line number Diff line number Diff line change
    @@ -4,19 +4,18 @@
    --track-origins=yes ./a.out

    * clang
    sudo apt-get install clang
    cd <c4_dir>
    make clean
    scan-build -V make
    * sudo apt-get install clang
    * cd <c4_dir>
    * make clean
    * scan-build -V make

    * splint ./*.c

    * rats ./*.c

    * canary detection
    gcc ... -fstack-protector -fstack-protector-all

    * gcc ... -fmudflap -fmudflapth -fmudflapir
    * gcc ... -fstack-protector -fstack-protector-all
    * gcc ... -fmudflap -fmudflapth -fmudflapir
    For front-ends that support it (C and C++), instrument all risky
    pointer/array dereferencing operations, some standard library
    string/heap functions, and some other associated constructs with
  3. rubienr created this gist Nov 16, 2016.
    35 changes: 35 additions & 0 deletions c-cpp-check-tools.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    * cppcheck --enable all ./*

    * valgrind --tool=memcheck --leak-check=full --show-reachable=yes
    --track-origins=yes ./a.out

    * clang
    sudo apt-get install clang
    cd <c4_dir>
    make clean
    scan-build -V make

    * splint ./*.c

    * rats ./*.c

    * canary detection
    gcc ... -fstack-protector -fstack-protector-all

    * gcc ... -fmudflap -fmudflapth -fmudflapir
    For front-ends that support it (C and C++), instrument all risky
    pointer/array dereferencing operations, some standard library
    string/heap functions, and some other associated constructs with
    range/validity tests. Modules so instrumented should be immune to
    buffer overflows, invalid heap use, and some other classes of C/C++
    programming errors. The instrumentation relies on a separate runtime
    library (libmudflap), which will be linked into a program if -fmudflap
    is given at link time. Run-time behavior of the instrumented program is
    controlled by the MUDFLAP_OPTIONS environment variable. See "env
    MUDFLAP_OPTIONS=-help a.out" for its options.
    Use -fmudflapth instead of -fmudflap to compile and to link if your
    program is multi-threaded. Use -fmudflapir, in addition to -fmudflap or
    -fmudflapth, if instrumentation should ignore pointer reads. This
    produces less instrumentation (and therefore faster execution) and still
    provides some protection against outright memory corrupting writes, but
    allows erroneously read data to propagate within a program.