Skip to main content

CBMC viewer produces a browsable summary of CBMC findings

Project description

CBMC Viewer

CBMC is a Bounded Model Checker for C. It can prove that (for computations of bounded depth) a C program exhibits no memory safe errors (no buffer overflows, no invalid pointers, etc), no undefined behaviors, and no failures of assertions in the code. CBMC Viewer is a tool that scans the output of CBMC and produces a browsable summary of its findings.

Example

Here is a simple example of using cbmc-viewer. Running this example requires installing CBMC. Installation on MacOS is just brew install cbmc. Installation on other operation systems is described on the CBMC release page.

Create a source file main.c containing

#include <stdlib.h>

static int global;

int main() {
  int *ptr = malloc(sizeof(int));

  assert(global > 0);
  assert(*ptr > 0);

  return 0;
}

and run the commands

goto-cc -o main.goto main.c
cbmc main.goto --trace --xml-ui > result.xml
cbmc main.goto --cover location --xml-ui > coverage.xml
cbmc main.goto --show-properties --xml-ui > property.xml
cbmc-viewer --goto main.goto --result result.xml --coverage coverage.xml --property property.xml --srcdir .

and open the report created by cbmc-viewer in a web browser with

open report/html/index.html

What you will see is

  • A coverage report summarizing what lines of source code were exercised by cbmc. In this case, coverage is 100%. Clicking on main, you can see the source code for main annotated with coverage data (all lines are green because all lines were hit).

  • A bug report summarizing what issues cbmc found with the code. In this case, the bugs are violations of the assertions because, for example, it is possible that the uninitialized integer allocated on the heap contains a negative value. For each bug, there is a link to

    • The line of code where the bug occurred.

    • An error trace showing the steps of the program leading to the bug. For each step, there a link to the line of code that generated the step, making it easy to follow the error trace and root cause the bug.

Documentation

The cbmc-viewer documentation includes a reference manual and a user guide. These documents are currently works in progress and will improve over time.

Installation

Most people should just follow the instructions on the release page.

Developers can install the package in Python "development mode" as follows.

  • Clone the repository and install dependencies with
        git clone https://github.com/awslabs/aws-viewer-for-cbmc.git cbmc-viewer
        apt install python3-pip python3-venv python3-jinja2 python3-voluptuous universal-ctags
    
    Installing ctags is optional. See the ctags discussion at the end of the release page.
  • Install development mode with
        cd cbmc-viewer
        make develop
        export PATH=/tmp/cbmc-viewer/bin:$PATH
    
  • Uninstall development mode with
        cd cbmc-viewer
        make undevelop
    

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cbmc_viewer-3.11.tar.gz (57.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cbmc_viewer-3.11-py3-none-any.whl (71.3 kB view details)

Uploaded Python 3

File details

Details for the file cbmc_viewer-3.11.tar.gz.

File metadata

  • Download URL: cbmc_viewer-3.11.tar.gz
  • Upload date:
  • Size: 57.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cbmc_viewer-3.11.tar.gz
Algorithm Hash digest
SHA256 698011925272121fb322eeff1e6965747b9cb7661a4487c219b817d271c31bfe
MD5 760bb2d8427c3aecc7fee99c8a2dfb7c
BLAKE2b-256 9469ff8e4c2053c79089c368ba6f7af3ce53c285e09e17de64662154ffea46e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbmc_viewer-3.11.tar.gz:

Publisher: release-pypi.yaml on model-checking/cbmc-viewer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cbmc_viewer-3.11-py3-none-any.whl.

File metadata

  • Download URL: cbmc_viewer-3.11-py3-none-any.whl
  • Upload date:
  • Size: 71.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cbmc_viewer-3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 9eddc0526b8bde44f5f819755d70c71e43333d1d466f1bdc785625b809f3909f
MD5 427e25512ccf666cb3642dcc584f115c
BLAKE2b-256 bd091342347fa50f0c4dddc94a93ec025ba11a7513cc4445d7a4d8b04c281a71

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbmc_viewer-3.11-py3-none-any.whl:

Publisher: release-pypi.yaml on model-checking/cbmc-viewer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page