#include <iostream>
#include <json/json.h>
using namespace std;
using namespace Json;
int main()
{
string s;
s = "957{\"uid\":\"181800860\"}";
//if the first is a character of number 0~9,
//then the following parse will not return false,
//but when running to the value["uid"], an expection is thrown
Value value;
Reader reader;
if (!reader.parse(s, value)) {
cout << "error" << endl;
return 0;
}
value["uid"];
}
This problem leads to even more serious issues.
All these checks will ALSO result in a crash, hence this is a very serious bug
This is now fixed via
strictMode
at: https://github.com/open-source-parsers/jsoncpp/