Skip to content

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

@hongxuchen

Description

@hongxuchen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions