Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
2.4.8
-
None
-
None
-
Minor Change
-
ALL
Description
Original title: BSONElement.validate() success on invalid BSON
There have been cases where BSONElement.validate() fails to recognize that an element is invalid. In the following code in tool.cpp we see the following:
BSONObj o( buf );
|
|
>>> BSONObj.valid() returns false signifying a corrupt BSON object.
|
if ( _objcheck && ! o.valid() ) {
|
cerr << "INVALID OBJECT - going try and pring out " << endl;
|
cerr << "size: " << size << endl;
|
BSONObjIterator i(o);
|
while ( i.more() ) {
|
BSONElement e = i.next();
|
try {
|
>>> e.validate() does not throw an exception and the "NEXT ONE" message is not printed.
|
e.validate();
|
}
|
catch ( ... ) {
|
cerr << "\t\t NEXT ONE IS INVALID" << endl;
|
}
|
cerr << "\t name : " << e.fieldName() << " " << e.type() << endl;
|
|
>>> An assertion is triggered on printing "e" (a BSONElement) to standard error.
|
cerr << "\t " << e << endl;
|
}
|
}
|
When we have a corrupt BSONElement, BSONElement.validate() should recognize and throw an exception.
Attachments
Issue Links
- is related to
-
SERVER-12260 batch_upconvert_test fails under address sanitizer
-
- Closed
-