SERVER-135353ClosedFixed
Heap use-after-free reading a write command's sort pattern from the plan cache
h2. Summary The per-statement {{sort}} field of the {{update}} and {{bulkWrite}} commands is declared as IDL type {{{}object{}}}, which is an unowned {{BSONObj}} view into the wire message buffer. The sort is threaded through the planner into {{{}MergeSortStats::sortPattern{}}}, which the plan cache retains in its debug info. Once the originating command completes its message buffer is freed, leaving the cached entry holding a dangling {{{}BSONObj{}}}. A later {{$planCacheStats}} aggregation