The parseNormalize() helper in canonical_query_test.cpp returns a MatchExpression created from a temporary BSONObj, which is not valid.
Note that the tests in this file happen to not examine the BSONElement members of the returned MatchExpression objects (which is how this issue went undetected).
- links to