Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-73463

Investigate IDL type serializers not being treated as free functions

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Server Security
    • ALL

      Given an IDL type definition like:

        mytype:
        bson_serialization_type: any
        cpp_type: MyType
        deserializer: "mongo::parseMyType"
        serializer: "::mongo::serializeMyType"
      

      Serialization will call `mongo::serializeMyType(const MyType& val, StringData fieldName, BSONObjBuilder* builder)`, however when the serialization type is narrowed, such as the following, the "::" prefix denoting a free function is ignored, and the type is serialized as `myType.serializeMyType(StringData fieldName, BSONObjBuilder* builder) const`.

        mytype:
        bson_serialization_type: [int, long, decimal, double]
        cpp_type: MyType
        deserializer: "mongo::parseMyType"
        serializer: "::mongo::serializeMyType"
      

      The behavior current exhibited by the `any` case at top is correct, while the more narrow type below is not.

            Assignee:
            backlog-server-security [DO NOT USE] Backlog - Security Team
            Reporter:
            sara.golemon@mongodb.com Sara Golemon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: