mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
SERVER-11525 Better error message on oversized BSON in JS
This commit is contained in:
parent
47499ce542
commit
98f35d3ff6
@ -1658,7 +1658,14 @@ namespace mongo {
|
||||
v8::Local<v8::Value> value = o->Get(name);
|
||||
v8ToMongoElement(b, sname, value, depth + 1, &originalBSON);
|
||||
}
|
||||
return b.obj();
|
||||
|
||||
const int sizeWithEOO = b.len() + 1/*EOO*/ - 4/*BSONObj::Holder ref count*/;
|
||||
uassert(17260, str::stream() << "Converting from JavaScript to BSON failed: "
|
||||
<< "Object size " << sizeWithEOO << " exceeds limit of "
|
||||
<< BSONObjMaxUserSize << " bytes.",
|
||||
sizeWithEOO <= BSONObjMaxUserSize);
|
||||
|
||||
return b.obj(); // Would give an uglier error than above for oversized objects.
|
||||
}
|
||||
|
||||
// --- random utils ----
|
||||
|
Loading…
Reference in New Issue
Block a user