Uploaded image for project: 'PHP Legacy Driver'
  1. PHP Legacy Driver
  2. PHP-1483

GridFS file storage fails on big endian platform

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 1.6.11
    • Fix Version/s: 1.6.13
    • Component/s: pecl-mongo
    • Labels:
      None
    • Environment:
    • # Replies:
      6
    • Last comment by Customer:
      true

      Description

      I built the PHP MongoDB driver on a Linux Z system (big endian) but was not able to get it to store a file to MongoDB.

      When I invoked gridfs storeFile the program ran out of memory.

      I found that it was due to the chunk_size parameter having a value of zero, causing an infinite loop when reading the file.

      chunk_size seems to be handled in an inconsistent way. Initialised as a Long but read as an Int.

      By default it is initialised to 261120, which when stored as a Long would be read as zero if seen as an Int (on big endian), but read as 261120 if seen as an Int (on little endian).

      Changing the declaration of the chunk_size variable from Int to Long appears to fix the problem on big endian and not cause an issue on little endian (previously passing tests provided with the driver continue to pass).

      The change affects php_mongo.c only. Diff of the change for release 1.6.11 as follows:-
      503c503
      < int chunk_size;

      > long chunk_size;

      Please could you fix this issue.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                3 years, 44 weeks, 5 days ago
                Date of 1st Reply: