Giter Club home page Giter Club logo

Comments (2)

XavierCooney avatar XavierCooney commented on September 12, 2024

So @Dylan-Brotherston has let me know that including unistd.h disables ASAN, but this is still detectable by valgrind, so would be good to turn that on when ASAN gets diabled?

$ dcc bug.c -o bug -fsanitize=valgrind
$ echo ABCD | ./bug
Runtime error: uninitialized variable accessed.

Execution stopped in main() in bug.c at line 11:

int main(int argc, char **argv) {
    char arr[5];
    fread(arr, 1, 4, stdin);
--> if (strcmp(arr, "ABCD") != 0) {
        printf("match\n");
    }
}

Values when execution stopped:

argc = 1
arr = "ABCD<uninitialized value>"

from dcc.

Dylan-Brotherston avatar Dylan-Brotherston commented on September 12, 2024

DCC has a list of "safe" includes here:

safe_c_includes_basenames = [

unistd.h isn't in that list because some functions provided by that header will case the dual sanitizers to become unsynchronized.

in this situation when compiling only one sanitizer will be included, by default sanitizer1 is the ASAN sanitizer and ASAN cannot detect this error, MSAN or Valgrind (usually sanitizer2) can detect this error.

Explicitly setting the first sanitizer to Valgrind with -fsanitize=valgrind fixes this issue, but then ASAN will not be running and other issues will be missed.

So currently this is intended behavior. best to run both dcc and dcc -fsanitize=valgrind separately in this case.

from dcc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.