-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
-
Query Execution 2021-05-17, Query Execution 2021-05-31
This code assumes that 'keys' and 'values' get moved into the sorter. However, not all implementations of the sorter's emplace() method actually move from the passed in key. See here for example.
Consider the following scenario:
1) the sort stage is opened, and calls getNext() on its child. It calls copyOrMove() on its inAccessors, moving ownership to local variables 'keys' and 'vals'. Keep in mind that SBE "move" is non-destructive, unlike a C++ std::move(). So the inAccessors still point to the same values, just their 'owned' flag is now false.
2) The call to emplace() is made to an overload which does not move from the arguments.
3) The local variables 'keys' and 'vals' go out of scope. The underlying memory is freed. Now the inAccessors are pointing to garbage.
- is depended on by
-
SERVER-52799 Make sbe the default execution engine and switch "SBE" build variant to "SBE off"
- Closed
- related to
-
SERVER-56869 [SBE][ASAN jscore] heap-use-after-free during computed_projections.js
- Closed