-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Programmability
-
ALL
-
SP Prioritized List
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The _updateFrame function in bson_validate.cpp can generate BSONElement objects with improper field name sizes here.
We recently discovered that while adding validation of the field name length-related invariants to the BSONElement constructor that uses the TrustedInitTag. During the fix for SERVER-104392, we temporarily added a dassert to the TrustedInitTag ctor of BSONElement, and it started failing when being called from bson_validate.cpp in a required patch set.
The currently implicit assumptions for creating a BSONElement via the TrustedInitTag ctor is that the fieldNameSize value is 0 if the data pointer of the BSONElement points to an EOO value, and for non-EOO elements the fieldNameSize value is supposed to include the NUL-terminator.
This is currently not guaranteed by the call site in bson_validate.cpp. It can create BSONElement objects with parameters for which these invariants do not hold.
The call site should either be fixed so that its parameters for creating BSONElements are in accordance with the invariants. Alternatively, the validator can use a different type than BSONElement to refer to the memory block, e.g. some BSONElement-like struct that have such invariants.
- related to
-
SERVER-104738 Fix invalid fieldNameSizes in BSONElement TrustedInitTag ctor calls from BSONColumn code
-
- Closed
-