Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-156

GridFS off-by-one bug in lastChunkNumber() causes uncaught throw and data loss

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4
    • Affects Version/s: 1.3
    • Component/s: None
    • Environment:
      All

      A pull request has been opened with a proposed fix and reproducing test here: https://github.com/mongodb/node-mongodb-native/pull/1154

      This is an extremely severe bug in that it causes an uncaught thrown error emanating from the mongodb core (during the md5 sum recalculation) due to a corruption of the chunk numbering following a write of appended data.

      The bug occurs when appending (write mode: "w+") to an existing non-zero length gridFS file with file length exactly equal to a multiple of its chunkSize. That is, when:

      (file.length > 0) && ( file.length % file.chunkSize === 0 )

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            vsi Vaughn Iverson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: