Fix segmentation fault in python upb when instantiating field via repeated field assignment

PiperOrigin-RevId: 451406772
pull/13171/head
Protobuf Team 3 years ago committed by Copybara-Service
parent ef78b6a093
commit 04cb5af6b6
  1. 2
      python/repeated.c

@ -439,7 +439,7 @@ static int PyUpb_RepeatedContainer_AssignSubscript(PyObject* _self,
PyObject* value) {
PyUpb_RepeatedContainer* self = (PyUpb_RepeatedContainer*)_self;
const upb_FieldDef* f = PyUpb_RepeatedContainer_GetField(self);
upb_Array* arr = PyUpb_RepeatedContainer_GetIfReified(self);
upb_Array* arr = PyUpb_RepeatedContainer_EnsureReified(_self);
Py_ssize_t size = arr ? upb_Array_Size(arr) : 0;
Py_ssize_t idx, count, step;
if (!IndexToRange(key, size, &idx, &count, &step)) return -1;

Loading…
Cancel
Save