Giter Club home page Giter Club logo

ros_fuzzing_api's Introduction

ROS Fuzzing API

Cmake CI Hits GitHub stars GitHub forks GitHub repo size in bytes GitHub contributors GitHub license

Header-only library to generate C++ type primitives for fuzzing ROS 2. This library conforms to the official documentation.

Installation

Clone this repository and link it appropriately in a CMakeLists.txt file with the fuzzing_api_library cmake library.

Usage

Import the fuzzing_api.hpp file and pass the variable by reference to be read. All the functions return a boolean indicating whether the reading was successful or not, so using them inside of if and while statements is useful. Check the file for the whole list.

Examples

Read one value:

#include <iostream>
#include "fuzzing_api.hpp"

int main() {
    float f;
    if (getFloat32(f)) {
        std::cout << "I read: " << f << std::endl;
    } else {
        std::cerr << "Couldn't read a float" << std::endl;
    }
}

Read as many pairs of values as possible:

#include <iostream>
#include "fuzzing_api.hpp"

int main() {
    int8_t a, b;
    while (getInt8(a) && getInt8(b)) {
        std::cout << "Pair: (a, b) = (" << a << ", " << b << ")" std::endl;
    }
}

Reading a string of a constrained size (always recommended with strings):

#include <iostream>
#include "fuzzing_api.hpp"

int main() {
    uint8_t length;
    getUInt8(length);

    std::string s;
    if (getString(s, length % 30)) {
        std::cout << "A string shorter than 30 characters:";
        std::cout << s << std::endl;
    } else {
        std::cerr << "Couldn't read the string" << std::endl;
    }
}

Test

Run the fuzz.sh command with source fuzz.sh to start a 10 minute fuzzing session. If you haven't installed it yet, install AFL (apt-get install afl or brew install afl on Mac).

License

MIT

Acknowledgements

rosin_logo

Supported by ROSIN - ROS-Industrial Quality-Assured Robot Software Components. More information: rosin-project.eu

eu_flag

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 732287.

ros_fuzzing_api's People

Contributors

jnxf avatar

Watchers

 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.