[SERVER-12006] Fixed potential pointer overflow leading to infinite loop Created: 09/Dec/13 Updated: 11/Jul/16 Resolved: 13/Dec/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage |
| Affects Version/s: | None |
| Fix Version/s: | 2.5.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jared Wong | Assignee: | Andy Schwerin |
| Resolution: | Done | Votes: | 0 |
| Labels: | pull-request | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
All |
||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | ALL |
| Participants: |
| Description |
|
Fixed potential pointer overflow leading to an infinite loop in In order to iterate over the data in the record there was a previous loop that const char * addr = _data; this will not work as expected because the addr pointer may overflow. Consider the size of _data, where it is defined in mongo::ps::Slice as: Entry _data[SliceSize] Here _netLength is defined as: int _netLength() const { return _lengthWithHeaders - HeaderSize; }in mongo/db/pdfile.h. Where HeaderSize = 16 and _lengthWithHeaders is set in a int& lengthWithHeaders() { _accessing(); return _lengthWithHeaders; }in mongo/db/pdfile.h. Assuming we can't guarantee anything about the exact value of _netLength (for In C, it is undefined behavior to increment a pointer (in this case addr) more If the compiler so chooses, it may wrap around the pointer if it increases past |
| Comments |
| Comment by Githook User [ 13/Dec/13 ] |
|
Author: {u'username': u'jaredlwong', u'name': u'Jared Wong', u'email': u'jaredlwong@gmail.com'}Message: In order to iterate over the data in the record there was a previous loop that In C, it is undefined behavior to increment a pointer (in this case addr) more If the compiler so chooses, it may wrap around the pointer if it increases past Signed-off-by: Matt Kangas <matt.kangas@mongodb.com> |