[3.0.9 backport] Panic inside Mutable1xBody for nil shallow copy

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.

Activity

Show:

CB robot September 25, 2023 at 4:55 PM

Build sync_gateway-3.0.9-8 contains sync_gateway commit 167ee18 with commit message:
add missing database close in test (#6462)

CB robot September 19, 2023 at 1:04 PM

Build sync_gateway-3.0.9-4 contains sync_gateway commit ef39461 with commit message:
: [3.0.9] Fix panic for assigning to nil map inside Mutable1xBody (#6428)

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Components

Sprint

Fix versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created September 18, 2023 at 12:32 PM
Updated August 31, 2024 at 11:01 AM
Resolved September 19, 2023 at 11:35 AM
Instabug