GithubHelp home page GithubHelp logo

ublinter's Introduction

ublinter

Linter for C/C++ code with a focus on undefined behaviour. Current checkers:

  • division by zero
  • integer overflow

The goal is to add checkers for all undefined behaviour.

ublinter doesn't look for syntax errors.

False positives / False negatives

The idea is that ublinter will warn when the code looks suspicious / dangerous. it won't try to proove that there is something wrong.

Still, don't expect that ublinter is sound (detects all UB). A sound tool would warn for every operation unless it can proove that nothing bad can ever happen.

When using ublinter, lots of false positives must be expected.

Normally, static analysis tools are used during development. The tools are perhaps used by the developers before every commit. And the developers try to fix all the warnings the tools produce. ublinter is not intended to be used in this way - the false positives makes this usage impractical.

The recommendation is that you use ublinter as a verification tool. For instance:

  • After you or your team has worked for a while on a functionality, you can use ublinter as a verification that the functionality works. Run ublinter on your file and look at all warnings.
  • When a release candidate is created you could run ublinter on it and look at all warnings.
  • Run ublinter once a week on your source code, diff the results and only investigate new results.
  • etc

You can use ublinter as a complement to your static analysis tools.

Design ideas

ublinter will assume that all conditions can always be both true/false. There will be no, or very little, handling of impossible execution paths.

ublinter will assume that signed variables can be negative.

Usage

Cppcheck is used to parse the code and create a dumpfile. Then the dump file is used by ublinter to look for UB.

Right now, you must manually create the cppcheck dump file and pass it to ublinter.

To scan a file 1.c with ublinter:

cppcheck --dump 1.c
python ublinter.py 1.c.dump

This usage is not ideal. Hopefully it will be easier in the future. At least in theory, the Cppcheck binaries (CLI+GUI+etc) could be enhanced so cppcheck extensions can be used in analysis.

The intention is that the output-format from ublinter will be similar to Cppcheck. So plugins / report generators / etc can be reused for both Cppcheck and ublinter with minimal effort.

ublinter's People

Contributors

danmar avatar xhmikosr avatar

Watchers

 avatar James Cloos avatar  avatar

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.