Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d653bd

Browse files
committed
fix security hole for string-key-lengths > 2^30
1 parent 585b267 commit 2d653bd

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/lib_json/json_reader.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,7 @@ bool OurReader::readObject(Token& tokenStart) {
14301430
return addErrorAndRecover(
14311431
"Missing ':' after object member name", colon, tokenObjectEnd);
14321432
}
1433+
if (name.length() >= (1U<<30)) throw std::runtime_error("keylength >= 2^30");
14331434
Value& value = currentValue()[name];
14341435
nodes_.push(&value);
14351436
bool ok = readValue();

src/lib_json/json_value.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ void Value::CommentInfo::setComment(const char* text, size_t len) {
191191

192192
// Notes: policy_ indicates if the string was allocated when
193193
// a string is stored.
194-
//
195-
// TODO: Check for length > 1GB, in Reader.
196194

197195
Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {}
198196

0 commit comments

Comments
 (0)