Skip to content
Permalink
Browse files Browse the repository at this point in the history
Merge pull request #513 from protobuf-c/edmonds/issue499
Fix issue #499: unsigned integer overflow
  • Loading branch information
edmonds committed Jul 11, 2022
2 parents fc9b2b2 + 0d1fd12 commit ec3d900
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions protobuf-c/protobuf-c.c
Expand Up @@ -2603,10 +2603,13 @@ parse_required_member(ScannedMember *scanned_member,
return FALSE;

def_mess = scanned_member->field->default_value;
subm = protobuf_c_message_unpack(scanned_member->field->descriptor,
allocator,
len - pref_len,
data + pref_len);
if (len >= pref_len)
subm = protobuf_c_message_unpack(scanned_member->field->descriptor,
allocator,
len - pref_len,
data + pref_len);
else
subm = NULL;

if (maybe_clear &&
*pmessage != NULL &&
Expand Down

0 comments on commit ec3d900

Please sign in to comment.