-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: BSON
-
None
-
bson-ruby now performs more validations when decoding BSON documents. Some decodable but technically invalid documents will be rejected. Some documents that are not decodable will be flagged as such earlier in the decoding process.
-
Minor Change
Currently on master when the failing tests in bson corpus are run, the bson content is not hex-decoded before being attempted to be decoded as bson. As a result, all of the decoding attempts fail (which makes all tests pass) but the library does not actually fail parsing of a number of cases once the input data is properly hex-decoded.
Add hex-decoding of bson input data to corpus spec runner for expected failures
Enforce that strings are valid utf-8 byte sequences when reading strings and symbols
Enforce that strings end with null bytes
Verify hashes' byte sizes are equal to claimed byte sizes
Verify arrays' byte sizes are equal to claimed byte sizes
Verify code with scope length is correct
The hash and array byte size verification in particular helps ensure that after invalid arrays/hashes, bson-ruby does not attempt to continue reading a potentially broken byte stream.