[SERVER-3505] V1 index broken for BinData larger than 32 bytes Created: 29/Jul/11  Updated: 12/Jul/16  Resolved: 04/Aug/11

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 1.9.1
Fix Version/s: 1.9.2

Type: Bug Priority: Blocker - P1
Reporter: Mathias Stearn Assignee: Dwight Merriman
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Base64 of 33byte string created like this in python:
In [7]: ('x'*33).encode('base64')
Out[7]: 'eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4\n'

> db.foo.drop()
true
> b = new BinData(0,'eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4')
BinData(0,"eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4")
> db.foo.insert(

{b:b}

)
> db.foo.count(

{b:b}

)
1
> db.foo.ensureIndex(

{b:1}

,

{v:1}

)
> db.foo.count(

{b:b}

)
0
> db.foo.dropIndex(

{b:1}

)

{ "nIndexesWas" : 2, "ok" : 1 }

> db.foo.ensureIndex(

{b:1}

,

{v:0}

)
> db.foo.count(

{b:b}

)
1

The problem is in KeyV1Owned constructor. We need to check if len <= 32 before this line https://github.com/mongodb/mongo/blob/master/db/key.cpp#L267



 Comments   
Comment by auto [ 04/Aug/11 ]

Author:

{u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-3505 bindata in v1 indexes > 32 bytes fix
Branch: master
https://github.com/mongodb/mongo/commit/53a69ce6c98be5fafe1dd864d595fe8755b8ded8

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