-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.9
-
Component/s: Serialization
-
None
-
Environment:Windows
-
Fully Compatible
I came across the following error when I tried to serialize one of our documents. We submit exception documents with our product. So the following document came from a security scan of some kind.. Anyways mongo blew up and we caught the exception. We have a few hundred reports of this.
The value trying to be inserted is "\u0000\"><script>alert(309)</script>"
System.ArgumentException : Element names cannot contain nulls.
Parameter name: name
at MongoDB.Bson.IO.BsonWriter.WriteName(String name) in BsonWriter.cs: line 506
at MongoDB.Bson.Serialization.Serializers.DictionarySerializer`2.Serialize(BsonWriter bsonWriter, Type nominalType, Object value, IBsonSerializationOptions options) in DictionaryGenericSerializer.cs: line 194
at MongoDB.Bson.Serialization.BsonClassMapSerializer.SerializeMember(BsonWriter bsonWriter, Object obj, BsonMemberMap memberMap) in BsonClassMapSerializer.cs: line 692
at MongoDB.Bson.Serialization.BsonClassMapSerializer.Serialize(BsonWriter bsonWriter, Type nominalType, Object value, IBsonSerializationOptions options) in BsonClassMapSerializer.cs: line 432
at MongoDB.Bson.Serialization.BsonSerializer.Serialize(BsonWriter bsonWriter, Type nominalType, Object value, IBsonSerializationOptions options) in BsonSerializer.cs: line 805
at MongoDB.Bson.BsonExtensionMethods.ToJson(Object obj, Type nominalType, IBsonSerializationOptions options, JsonWriterSettings settings) in BsonExtensionMethods.cs: line 304
at MongoDB.Bson.BsonExtensionMethods.ToJson(Object obj, Type nominalType, JsonWriterSettings settings) in BsonExtensionMethods.cs: line 319
at MongoDB.Bson.BsonExtensionMethods.ToJson(Object obj, Type nominalType) in BsonExtensionMethods.cs: line 271
at MongoDB.Bson.BsonExtensionMethods.ToJson(TNominalType obj) in BsonExtensionMethods.cs: line 220