Details
Description
The server accepts invalid regular expressions in the match language. It appears that such invalid regular expressions will match nothing:
> db.c.drop();
|
true
|
> db.c.insert({a: 1, b: "["});
|
WriteResult({ "nInserted" : 1 })
|
> db.c.find({a: 1, b: {$regex: "["}});
|
// Empty result set.
|
In order to fix this, the MatchExpression library should call pcrecpp::RE::error() and check whether the resulting error string is non-empty:
This bug appears to affect all versions of the server since at least 2.6.
Attachments
Issue Links
- causes
-
SERVER-34933 pcre verb support
-
- Closed
-
- related to
-
SERVER-32356 Use of options:x and comments with $regex search including \n can lead to incorrect documents being returned
-
- Closed
-
-
SERVER-39697 Regex MatchExpression should error at parse time if the regex is not valid
-
- Closed
-