[JAVA-1864] Driver should throw BsonSerializationException when corrupt BSON is encountered Created: 15/Jun/15  Updated: 07/Oct/15  Resolved: 22/Jun/15

Status: Closed
Project: Java Driver
Component/s: BSON
Affects Version/s: 3.0.2
Fix Version/s: 3.1.0

Type: Bug Priority: Minor - P4
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When the driver is presented with corrupt BSON to encode, it should throw a BsonSerializationException. It should not successfully parse the BSON, and it should not throw other runtime exceptions.

Examples where this is not currently the case include:

  • When the length of a BSON string is negative
  • When a BSON string is not properly null-terminated
  • When the buffer is not large enough to read the expected bytes (e.g., an Int32 is expected but there are < 4 bytes remaining)


 Comments   
Comment by Jeffrey Yemin [ 07/Oct/15 ]

Released in 3.1.0

Comment by Githook User [ 22/Jun/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: Added JSON-powered BSON encoding and decoding tests of well-formed and corrupted BSON

JAVA-1864
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/8c5a20d786e66ee4c4b0d743f0f80bf681c419be

Comment by Githook User [ 22/Jun/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: Throwing proper exception in BsonBinaryWriter.pipe when document size is too small

JAVA-1864
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/f6cc807cd3f40f57cb7c23f12dd2f1bd251de21c

Comment by Githook User [ 22/Jun/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: Added check that a decoded boolean value has either the value 0 or the value 1.

JAVA-1864
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/e36833e6cbd3970f32e35f7bc0d730d8d1b078df

Comment by Githook User [ 22/Jun/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: Ensured that the decoded BSON type is valid.

JAVA-1864
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/5e50e18914cb1ccf1bb8d9e0d9231e2f342074ef

Comment by Githook User [ 22/Jun/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: When decoding corrupted BSON, the driver should throw BsonSerializationException rather than other runtime exceptions.

JAVA-1864
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/a08422fe65008d8ee5d3a2c6dcb41d67556a9a04

Generated at Thu Feb 08 08:55:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.