cierelabs/json_spirit

Stack overflow error when input file contains too many "["

Opened this issue · 1 comments

We found with our fuzzer that json_spirit may still suffer from stack overflow when input file contains too many [s.

Driver:

#include <string>
#include <fstream>
#include <streambuf>
#include <iostream>
#include "ciere/json/io.hpp"
#include "ciere/json/value.hpp"

using namespace ciere;

int main(int argc, char** argv) {
    std::ifstream t(argv[1]);
    std::string str((std::istreambuf_iterator<char>(t)),
            std::istreambuf_iterator<char>());
    auto res = json::construct(str);
    std::cout<<res<<"\n";
}

Sample input:
test.txt

Thanks for the report. Gotta love fuzzers.