Commit be01d3d7 authored by Philipp A. Hartmann's avatar Philipp A. Hartmann

fix build on travis-ci.org

Some early returns were missing after the removal of longjmp in #22.
This has led to segfaults on Linux (confirmed locally).
parent fbf29dfc
...@@ -243,12 +243,16 @@ public: ...@@ -243,12 +243,16 @@ public:
case '[': ParseArray<parseFlags>(is, handler); break; case '[': ParseArray<parseFlags>(is, handler); break;
default: RAPIDJSON_PARSE_ERROR_NORETURN("Expect either an object or array at root", is.Tell()); default: RAPIDJSON_PARSE_ERROR_NORETURN("Expect either an object or array at root", is.Tell());
} }
if (HasParseError())
goto out;
SkipWhitespace(is); SkipWhitespace(is);
if (is.Peek() != '\0') if (is.Peek() != '\0')
RAPIDJSON_PARSE_ERROR_NORETURN("Nothing should follow the root object or array.", is.Tell()); RAPIDJSON_PARSE_ERROR_NORETURN("Nothing should follow the root object or array.", is.Tell());
} }
out:
stack_.Clear(); stack_.Clear();
return !HasParseError(); return !HasParseError();
} }
...@@ -414,6 +418,8 @@ private: ...@@ -414,6 +418,8 @@ private:
if (parseFlags & kParseInsituFlag) { if (parseFlags & kParseInsituFlag) {
Ch *head = s.PutBegin(); Ch *head = s.PutBegin();
ParseStringToStream<parseFlags, SourceEncoding, SourceEncoding>(s, s); ParseStringToStream<parseFlags, SourceEncoding, SourceEncoding>(s, s);
if (HasParseError())
return;
size_t length = s.PutEnd(head) - 1; size_t length = s.PutEnd(head) - 1;
RAPIDJSON_ASSERT(length <= 0xFFFFFFFF); RAPIDJSON_ASSERT(length <= 0xFFFFFFFF);
handler.String((typename TargetEncoding::Ch*)head, SizeType(length), false); handler.String((typename TargetEncoding::Ch*)head, SizeType(length), false);
...@@ -421,6 +427,8 @@ private: ...@@ -421,6 +427,8 @@ private:
else { else {
StackStream stackStream(stack_); StackStream stackStream(stack_);
ParseStringToStream<parseFlags, SourceEncoding, TargetEncoding>(s, stackStream); ParseStringToStream<parseFlags, SourceEncoding, TargetEncoding>(s, stackStream);
if (HasParseError())
return;
handler.String(stack_.template Pop<typename TargetEncoding::Ch>(stackStream.length_), stackStream.length_ - 1, true); handler.String(stack_.template Pop<typename TargetEncoding::Ch>(stackStream.length_), stackStream.length_ - 1, true);
} }
is = s; // Restore is is = s; // Restore is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment