Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-3030

[3.1.1 backport] Panic inside Mutable1xBody for nil shallow copy

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.1.1
    • None
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 126
    • 1

    Description

      We don't have sufficient handling for a nil doc body retruned by shallow copy inside the function Mutable1xBody.

      When we take a shallow copy of the document here https://github.com/couchbase/sync_gateway/blob/fe16b931b3923052ae6a8d4e6b400300ec86b6ab/db/revision_cache_interface.go#L160

      If we get a nil body returned here we can get a panic here https://github.com/couchbase/sync_gateway/blob/fe16b931b3923052ae6a8d4e6b400300ec86b6ab/db/revision_cache_interface.go#L165 by trying to assign to a nil map. We should have a check to see if b in this code is nil and if so we should initialise an empty body so we can assign the rev and doc id without panicing.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              gregory.newmansmith Gregory Newman-Smith
              adamf Adam Fraser
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty