A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/protocolbuffers/protobuf/commit/21fdb7acdb11fbca234570fa30d2e5687eaf12f6 below:

contains check segfaults on empty map (#20446) (#20904) · protocolbuffers/protobuf@21fdb7a · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+6

-0

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+6

-0

lines changed Original file line number Diff line number Diff line change

@@ -683,6 +683,11 @@ def testDurationSub(self, old_time, time_delta, expected_sec, expected_nano):

683 683 684 684

class StructTest(unittest.TestCase):

685 685 686 +

def testEmptyDict(self):

687 +

# in operator for empty initialized struct

688 +

msg = well_known_types_test_pb2.WKTMessage(optional_struct={})

689 +

self.assertNotIn('key', msg.optional_struct)

690 + 686 691

def testStruct(self):

687 692

struct = struct_pb2.Struct()

688 693

self.assertIsInstance(struct, collections_abc.Mapping)

Original file line number Diff line number Diff line change

@@ -1103,6 +1103,7 @@ static PyObject* PyUpb_Message_Contains(PyObject* _self, PyObject* arg) {

1103 1103

upb_Message* msg = PyUpb_Message_GetMsg(self);

1104 1104

const upb_FieldDef* f = upb_MessageDef_FindFieldByName(msgdef, "fields");

1105 1105

const upb_Map* map = upb_Message_GetFieldByDef(msg, f).map_val;

1106 +

if (!map || upb_Map_Size(map) == 0) Py_RETURN_FALSE;

1106 1107

const upb_MessageDef* entry_m = upb_FieldDef_MessageSubDef(f);

1107 1108

const upb_FieldDef* key_f = upb_MessageDef_Field(entry_m, 0);

1108 1109

upb_MessageValue u_key;

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4