switch ((json++)->unicode()) {
case 'n':
- if (end - json < 4) {
+ if (end - json < 3) {
lastError = QJsonParseError::IllegalValue;
return false;
}
lastError = QJsonParseError::IllegalValue;
return false;
case 't':
- if (end - json < 4) {
+ if (end - json < 3) {
lastError = QJsonParseError::IllegalValue;
return false;
}
lastError = QJsonParseError::IllegalValue;
return false;
case 'f':
- if (end - json < 5) {
+ if (end - json < 4) {
lastError = QJsonParseError::IllegalValue;
return false;
}
a->arrayReserve(size);
for (int i = 0; i < size; i++)
a->arrayData[i].value = fromJsonValue(engine, array.at(i));
+ a->arrayDataLen = size;
a->setArrayLengthUnchecked(size);
return Value::fromObject(a);
}
<< "array" << "(function() { var a = [10, 20]; a.__proto__ = { proto_foo: 123 }; return a; })()"
<< "[10,20]";
- // Non-enumerable properties should be included.
+ // Non-enumerable properties should not be included.
QTest::newRow("value = object with non-enumerable property")
<< "value" << "Object.defineProperty({}, 'foo', { value: 123, enumerable: false })"
- << "{\"foo\":123}";
+ << "{}";
QTest::newRow("object = object with non-enumerable property")
<< "object" << "Object.defineProperty({}, 'foo', { value: 123, enumerable: false })"
- << "{\"foo\":123}";
+ << "{}";
// Cyclic data structures are permitted, but the cyclic links become
// empty objects.