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

XMLWordPrintableJSON

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

      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:
              Christian Amor Kvalheim
              Reporter:
              Vaughn Iverson
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: