From 2911f81a185f4938675b6764a69c3aab481538b6 Mon Sep 17 00:00:00 2001 From: Intel Date: Sun, 11 May 2014 13:33:42 -0400 Subject: [PATCH] JSON Parser Crash Fix --- src/server/shared/JSON/JSONReader.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/server/shared/JSON/JSONReader.h b/src/server/shared/JSON/JSONReader.h index fa66894..c56134d 100644 --- a/src/server/shared/JSON/JSONReader.h +++ b/src/server/shared/JSON/JSONReader.h @@ -5,10 +5,12 @@ #include "JSON.h" #include +#include #include #include #include +namespace iso8859_1 = boost::spirit::iso8859_1; namespace qi = boost::spirit::qi; namespace ascii = boost::spirit::ascii; @@ -130,7 +132,7 @@ namespace JSONReader qi::real_parser > strict_double; template - struct Grammar : qi::grammar + struct Grammar : qi::grammar { Grammar(SemanticFunctions& smfunc) : _smfunc(smfunc), Grammar::base_type(json) { @@ -162,15 +164,15 @@ namespace JSONReader number = strict_double[NewDouble] | qi::long_long[NewInt]; } - qi::rule json; - qi::rule object; - qi::rule members; - qi::rule pair; - qi::rule array; - qi::rule elements; - qi::rule value; - qi::rule string; - qi::rule number; + qi::rule json; + qi::rule object; + qi::rule members; + qi::rule pair; + qi::rule array; + qi::rule elements; + qi::rule value; + qi::rule string; + qi::rule number; // Functions SemanticFunctions& _smfunc; @@ -184,7 +186,7 @@ namespace JSONReader std::string::const_iterator begin = str.begin(); std::string::const_iterator end = str.end(); - if (!qi::phrase_parse(begin, end, g, ascii::space)) + if (!qi::phrase_parse(begin, end, g, iso8859_1::space)) throw JSONException("Failed to parse JSON"); } }