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

Add downcast to derived slot accessor type before writing it's address in code fragment

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution

      This relies on the fact that derived class (OwnedValueAccessor) and based class (SlotAccessor) have offset of 0:

      https://github.com/10gen/mongo/blob/master/src/mongo/db/exec/sbe/vm/vm.cpp#L553

      While this is usually true, it is a compiled-dependent behavior, see:
      https://en.cppreference.com/w/cpp/language/derived_class
       

       Each direct and indirect base class is present, as base class subobject, within the object representation of the derived class at an ABI-dependent offset. Empty base classes usually do not increase the size of the derived object due to empty base optimization. The constructors of base class subobjects are called by the constructor of the derived class: arguments may be provided to those constructors in the member initializer list.

       
      We should downcast to proper that derived class before writing the pointer to code fragment.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            anna.wawrzyniak@mongodb.com Anna Wawrzyniak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: