[CXX-603] The gridfs api class GridFileBuilder corrupts data. Created: 19/May/15  Updated: 09/Jun/15  Resolved: 19/May/15

Status: Closed
Project: C++ Driver
Component/s: API
Affects Version/s: legacy-1.0.2
Fix Version/s: legacy-1.0.3

Type: Bug Priority: Critical - P2
Reporter: Charles Galambos Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: Bug, legacy-cxx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File mongogridfs.patch    

 Description   

The class mongo::GridFileBuilder, drops data from the stream, corrupting the data stored.

Using mongo::GridFileBuilder:appendChunk to append data of arbitrary block sizes drops part of the blocks. The function call _appendChunk( data + size, length - size,false) is used without checking if there is any further data to add to the pending buffer.

Attached is a patch to fix the issue.



 Comments   
Comment by Githook User [ 19/May/15 ]

Author:

{u'username': u'craftit', u'name': u'Charles Galambos', u'email': u'craftit@gmail.com'}

Message: CXX-603 Fix for dropping parts of blocks appended to a gridfs file with appendChunk

and add unit test for gridfs GridFileBuilder to check it handles block boundries correctly

Signed-off-by: Andrew Morrow <acm@mongodb.com>
Branch: legacy
https://github.com/mongodb/mongo-cxx-driver/commit/9980a0bfcb36b485c540a0fa372081eb610aa17d

Comment by Charles Galambos [ 19/May/15 ]

I've addressed the code review comments, and added a preliminary version of a unit test to detect the original bug. Unfortunately I am having problems getting the unit tests for integration working on my system.

Comment by Andrew Morrow (Inactive) [ 19/May/15 ]

https://github.com/mongodb/mongo-cxx-driver/pull/293

Comment by Charles Galambos [ 19/May/15 ]

I've forked the code on github, and created a pull request called 'Fix for corruption of data appended to a gridfs with appendChunk #293'

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