Preparing Coding Environment

This guide provides initial setup of writing queries using SEG APIs.

We assume you have finish the installation using the Docker image.

Compilation

Please go to userdef directory of the workspace.

cmake .
make -j

If everything goes well, you should see libMyChecker.so in the current directory.

Usage

To use your custom checker , select the path for Custom Checker (libMyChecker.so in this example) in Clearblue VSCode Extension, and insert the specified flag into Append Options to activate your custom checker.

Vulnerability Detection

For our DivideByZero example, it is registered with the following code:

static VulnerabilityRegistry<DivideByZero1>
    X("ps-dbz1", "Run path-sensitive divide-by-zero checker.", "ps-unstable");

Therefore, you should select -ps-dbz1 for the Append Options field in the extension to leverage our custom DivideByZero example.

Generate Program Query

For query example, it is registered as:


static RegisterPass<querySEG> Y("query", "SEG query", false, true);

Select -query for the Append Options field in the extension to leverage our query example.

Debugging


If no bugs are reported, it would be best for you to check the log files to make sure nothing went wrong.

Check PATH_TO_PROJECT/.clearblue/BINARY.bc.log for extraction logs.

Check PATH_TO_PROJECT/.clearblue/BINARY.json.log for checker logs.

If you find a bug in the extension or clearblue, please file an issue with logs attached.

Feedback

Was this page helpful?