Skip to content

Instantly share code, notes, and snippets.

@fuzz-ai
Created December 5, 2018 06:05
Show Gist options
  • Select an option

  • Save fuzz-ai/546ad1410b4461bdd3dee5d3c60723fd to your computer and use it in GitHub Desktop.

Select an option

Save fuzz-ai/546ad1410b4461bdd3dee5d3c60723fd to your computer and use it in GitHub Desktop.
fc::json::from_file test harness for AFL
#include <fc/variant.hpp>
#include <fc/io/json.hpp>
#include <fc/filesystem.hpp>
#include <fc/exception/exception.hpp>
#include <iostream>
using fc::path;
using fc::json;
using fc::variant;
int main( int argc, char *argv[] ) {
if ( argc < 2 ) {
return 1;
}
path inputFile( argv[1] );
try {
variant v = json::from_file( inputFile );
} catch ( fc::exception &e ) {
std::cout << e.to_string() << "\n";
return 1;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment