Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
29f27bfd
Commit
29f27bfd
authored
Oct 19, 2018
by
Parveen Bhatia
Committed by
Thomas Van Lenten
Nov 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added safety checks when malloc returns nil in GPBDescriptor
parent
eecccdc8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
GPBDescriptor.m
objectivec/GPBDescriptor.m
+5
-0
No files found.
objectivec/GPBDescriptor.m
View file @
29f27bfd
...
...
@@ -819,6 +819,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
return
;
}
uint32_t
*
offsets
=
malloc
(
valueCount_
*
sizeof
(
uint32_t
));
if
(
!
offsets
)
return
;
const
char
*
scan
=
valueNames_
;
for
(
uint32_t
i
=
0
;
i
<
valueCount_
;
++
i
)
{
offsets
[
i
]
=
(
uint32_t
)(
scan
-
valueNames_
);
...
...
@@ -851,6 +852,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
nameAsCStr
+=
prefixLen
;
if
(
nameOffsets_
==
NULL
)
[
self
calcValueNameOffsets
];
if
(
nameOffsets_
==
NULL
)
return
NO
;
// Find it.
for
(
uint32_t
i
=
0
;
i
<
valueCount_
;
++
i
)
{
...
...
@@ -867,6 +869,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
-
(
BOOL
)
getValue
:
(
int32_t
*
)
outValue
forEnumTextFormatName
:
(
NSString
*
)
textFormatName
{
if
(
nameOffsets_
==
NULL
)
[
self
calcValueNameOffsets
];
if
(
nameOffsets_
==
NULL
)
return
NO
;
for
(
uint32_t
i
=
0
;
i
<
valueCount_
;
++
i
)
{
int32_t
value
=
values_
[
i
];
...
...
@@ -905,6 +908,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
-
(
NSString
*
)
getEnumNameForIndex
:
(
uint32_t
)
index
{
if
(
nameOffsets_
==
NULL
)
[
self
calcValueNameOffsets
];
if
(
nameOffsets_
==
NULL
)
return
nil
;
if
(
index
>=
valueCount_
)
{
return
nil
;
...
...
@@ -916,6 +920,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
-
(
NSString
*
)
getEnumTextFormatNameForIndex
:
(
uint32_t
)
index
{
if
(
nameOffsets_
==
NULL
)
[
self
calcValueNameOffsets
];
if
(
nameOffsets_
==
NULL
)
return
nil
;
if
(
index
>=
valueCount_
)
{
return
nil
;
...
...
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