mongodb/mongo-ruby-driver — pull request #250 by TylerBrock (2013-08-16 19:26:06+00:00)
Title: RUBY-662 prevent ObjectId initialization with bad data

The problem described in the JIRA ticket is actually occurring because `ObjectID#to_s` in `cbson.c` expects an array of 12 bytes to be stored in `@data`. I did not want to change the interface for making ObjectIds from strings so this was the easiest way to do some basic checking of provided ObjectId data similar to what happens in the python driver here: https://github.com/mongodb/mongo-python-driver/blob/master/bson/objectid.py#L169