mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-04-27 10:25:58 +02:00
Fix poss SEGV
for non-null terminated input.
This commit is contained in:
parent
b063cf4ada
commit
f6d785fda8
@ -401,7 +401,7 @@ Reader::addComment(Location begin, Location end, CommentPlacement placement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Reader::readCStyleComment() {
|
bool Reader::readCStyleComment() {
|
||||||
while (current_ != end_) {
|
while ((current_ + 1) < end_) {
|
||||||
Char c = getNextChar();
|
Char c = getNextChar();
|
||||||
if (c == '*' && *current_ == '/')
|
if (c == '*' && *current_ == '/')
|
||||||
break;
|
break;
|
||||||
@ -520,7 +520,7 @@ bool Reader::readArray(Token& tokenStart) {
|
|||||||
currentValue().swapPayload(init);
|
currentValue().swapPayload(init);
|
||||||
currentValue().setOffsetStart(tokenStart.start_ - begin_);
|
currentValue().setOffsetStart(tokenStart.start_ - begin_);
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
if (*current_ == ']') // empty array
|
if (current_ != end_ && *current_ == ']') // empty array
|
||||||
{
|
{
|
||||||
Token endArray;
|
Token endArray;
|
||||||
readToken(endArray);
|
readToken(endArray);
|
||||||
@ -1361,7 +1361,7 @@ OurReader::addComment(Location begin, Location end, CommentPlacement placement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OurReader::readCStyleComment() {
|
bool OurReader::readCStyleComment() {
|
||||||
while (current_ != end_) {
|
while ((current_ + 1) < end_) {
|
||||||
Char c = getNextChar();
|
Char c = getNextChar();
|
||||||
if (c == '*' && *current_ == '/')
|
if (c == '*' && *current_ == '/')
|
||||||
break;
|
break;
|
||||||
@ -1503,7 +1503,7 @@ bool OurReader::readArray(Token& tokenStart) {
|
|||||||
currentValue().swapPayload(init);
|
currentValue().swapPayload(init);
|
||||||
currentValue().setOffsetStart(tokenStart.start_ - begin_);
|
currentValue().setOffsetStart(tokenStart.start_ - begin_);
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
if (*current_ == ']') // empty array
|
if (current_ != end_ && *current_ == ']') // empty array
|
||||||
{
|
{
|
||||||
Token endArray;
|
Token endArray;
|
||||||
readToken(endArray);
|
readToken(endArray);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user