[CDRIVER-2269] Crash on empty code string for code_w_s Created: 07/Sep/17  Updated: 28/Oct/23  Resolved: 12/Sep/17

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.8.0

Type: Bug Priority: Major - P3
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Case:

 Description   

When parsing BSON with a codewscope type we subtract 1 from the code string length. If it is 0 we underflow. (bson-iter.c:1410)

if (length) {
   memcpy (&len, iter->raw + iter->d2, sizeof (len));
    *length = BSON_UINT32_FROM_LE (len) - 1;
}



 Comments   
Comment by Ramon Fernandez Marina [ 14/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'Kevin Albertson', 'email': u'kevin.albertson@10gen.com'}

Message:CDRIVER-2269 Fix codewscope test
Branch:r1.4
https://github.com/mongodb/libbson/commit/5a23ee4f860e688e5a99217e54746d58c32b7496

Comment by Ramon Fernandez Marina [ 14/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'Kevin Albertson', 'email': u'kevin.albertson@10gen.com'}

Message:CDRIVER-2269 Check for zero string length in codewscope
Branch:r1.4
https://github.com/mongodb/libbson/commit/fbf6295e46b2986e58a1e761ee1e097e591f8cef

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'Kevin Albertson', 'email': u'kevin.albertson@10gen.com'}

Message:CDRIVER-2269 Check for zero string length in codewscope
Branch:master
https://github.com/mongodb/libbson/commit/42900956dc461dfe7fb91d93361d10737c1602b3

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'Kevin Albertson', 'email': u'kevin.albertson@10gen.com'}

Message:CDRIVER-2269 Check for zero string length in codewscope
Branch:r1.8
https://github.com/mongodb/libbson/commit/7ad507ac7e2270ccdd96fde5fd91c50d4af37e34

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'Kevin Albertson', 'email': u'kevin.albertson@10gen.com'}

Message:CDRIVER-2269 Fix codewscope test
Branch:master
https://github.com/mongodb/libbson/commit/e10059393466f667b031077229cfa98504ce34f3

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'Kevin Albertson', 'email': u'kevin.albertson@10gen.com'}

Message:CDRIVER-2269 Fix codewscope test
Branch:r1.8
https://github.com/mongodb/libbson/commit/ecf8b88fc00596f2815969a13f4eebac6d833b36

Comment by Kevin Albertson [ 12/Sep/17 ]

Commits:
https://github.com/mongodb/libbson/commit/42900956dc461dfe7fb91d93361d10737c1602b3
https://github.com/mongodb/libbson/commit/e10059393466f667b031077229cfa98504ce34f3

Generated at Wed Feb 07 21:14:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.