Fixed PHP-375: GridFS segfaults when there are more chunks than expected

We cannot blindly trust the size receieved from the files collection.
We need to track the data we are actually reading and copying into
memory so we don't try to stuff to much data in - invalid data even.