[CDRIVER-115] bson object should not be initialized in an assert—release mode code does not compile asserts Created: 24/Feb/12 Updated: 12/Apr/12 Resolved: 12/Apr/12 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 0.4 |
| Fix Version/s: | 0.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Matthew Proujansky | Assignee: | Kyle Banker |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Visual Studio 2005, Windows, release mode compilation |
||
| Description |
|
In mongodb-mongo-c-driver-1380839, version 0.4, in the file gridfs.c, line 129 is: When compiling this code in Visual Studio 2005 (and presumably other compilers), in debug mode the assert is compiled, but in release mode the assert is ignored. Therefore, in release mode the bson object "res" is not initialized, and when "res" is used on line 141: the code will crash. Initializing "res" should be done outside the assert. |