You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding any type of value to a Bson object which contains a BsonRegex, an AssertError is thrown.
The root cause is that the Bson raw data constructor has an assert(false) when Type == Regex (vibe.data.bson : 112).
Bson.opIndexAssign uses the Bson raw data constructor when copying its existing data to a new appender (vibe.data.bson : 464).
Some example code to demonstrate the issue:
auto bson = Bson.EmptyObject;
bson.someRegex = BsonRegex("", "");
bson.someOtherValue = ""; // Fails here
The text was updated successfully, but these errors were encountered:
I'm not sure why that assert has been placed there, but slicing m_data from 0 to after the second null terminator in the raw data constructor seems to work fine.
My apologies, but I'm not familiar enough with Git and GitHub to create a pull request atm. Will have to look into that some time. Anyway, here's what vibe.data.bson : 112 can be changed into to fix the issue:
case Type.Regex: {
auto _data = m_data;
_data.skipCString();
_data.skipCString();
m_data = m_data[0 .. $ - _data.length];
} break;
When adding any type of value to a Bson object which contains a BsonRegex, an AssertError is thrown.
The root cause is that the Bson raw data constructor has an assert(false) when Type == Regex (vibe.data.bson : 112).
Bson.opIndexAssign uses the Bson raw data constructor when copying its existing data to a new appender (vibe.data.bson : 464).
Some example code to demonstrate the issue:
The text was updated successfully, but these errors were encountered: