Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
protobuf-c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
protobuf-c
Commits
7b665e9c
Commit
7b665e9c
authored
Nov 22, 2013
by
Ilya Lipnitskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
protobuf-c/protobuf-c.c: add return code check to merge_messages calls
parent
54464b90
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
protobuf-c/protobuf-c.c
protobuf-c/protobuf-c.c
+8
-3
No files found.
protobuf-c/protobuf-c.c
View file @
7b665e9c
...
@@ -1606,7 +1606,10 @@ merge_messages (ProtobufCMessage *earlier_msg,
...
@@ -1606,7 +1606,10 @@ merge_messages (ProtobufCMessage *earlier_msg,
STRUCT_MEMBER_PTR
(
ProtobufCMessage
*
,
latter_msg
,
fields
[
i
].
offset
);
STRUCT_MEMBER_PTR
(
ProtobufCMessage
*
,
latter_msg
,
fields
[
i
].
offset
);
if
(
*
em
!=
NULL
)
if
(
*
em
!=
NULL
)
if
(
*
lm
!=
NULL
)
if
(
*
lm
!=
NULL
)
merge_messages
(
*
em
,
*
lm
,
allocator
);
{
if
(
!
merge_messages
(
*
em
,
*
lm
,
allocator
))
return
0
;
}
else
else
{
{
/* Zero copy the optional message */
/* Zero copy the optional message */
...
@@ -1670,6 +1673,7 @@ merge_messages (ProtobufCMessage *earlier_msg,
...
@@ -1670,6 +1673,7 @@ merge_messages (ProtobufCMessage *earlier_msg,
}
}
}
}
}
}
return
1
;
}
}
/* Given a raw slab of packed-repeated values,
/* Given a raw slab of packed-repeated values,
...
@@ -1926,6 +1930,7 @@ parse_required_member (ScannedMember *scanned_member,
...
@@ -1926,6 +1930,7 @@ parse_required_member (ScannedMember *scanned_member,
ProtobufCMessage
**
pmessage
=
member
;
ProtobufCMessage
**
pmessage
=
member
;
ProtobufCMessage
*
subm
;
ProtobufCMessage
*
subm
;
const
ProtobufCMessage
*
def_mess
;
const
ProtobufCMessage
*
def_mess
;
protobuf_c_boolean
merge_successful
=
1
;
unsigned
pref_len
=
scanned_member
->
length_prefix_len
;
unsigned
pref_len
=
scanned_member
->
length_prefix_len
;
def_mess
=
scanned_member
->
field
->
default_value
;
def_mess
=
scanned_member
->
field
->
default_value
;
subm
=
protobuf_c_message_unpack
(
scanned_member
->
field
->
descriptor
,
subm
=
protobuf_c_message_unpack
(
scanned_member
->
field
->
descriptor
,
...
@@ -1935,12 +1940,12 @@ parse_required_member (ScannedMember *scanned_member,
...
@@ -1935,12 +1940,12 @@ parse_required_member (ScannedMember *scanned_member,
if
(
maybe_clear
&&
*
pmessage
!=
NULL
&&
*
pmessage
!=
def_mess
)
if
(
maybe_clear
&&
*
pmessage
!=
NULL
&&
*
pmessage
!=
def_mess
)
{
{
if
(
subm
!=
NULL
)
if
(
subm
!=
NULL
)
merge_messages
(
*
pmessage
,
subm
,
allocator
);
merge_
successful
=
merge_
messages
(
*
pmessage
,
subm
,
allocator
);
/* Delete the previous message */
/* Delete the previous message */
protobuf_c_message_free_unpacked
(
*
pmessage
,
allocator
);
protobuf_c_message_free_unpacked
(
*
pmessage
,
allocator
);
*
pmessage
=
NULL
;
*
pmessage
=
NULL
;
}
}
if
(
subm
==
NULL
)
if
(
subm
==
NULL
||
!
merge_successful
)
return
0
;
return
0
;
*
pmessage
=
subm
;
*
pmessage
=
subm
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment