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
8eda7b7f
Commit
8eda7b7f
authored
Nov 15, 2019
by
Asra Ali
Committed by
Adam Cozzette
Dec 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ubsan warnings
Signed-off-by:
Asra Ali
<
asraa@google.com
>
parent
16b0c054
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
20 deletions
+32
-20
strutil.cc
src/google/protobuf/stubs/strutil.cc
+32
-20
No files found.
src/google/protobuf/stubs/strutil.cc
View file @
8eda7b7f
...
...
@@ -1435,32 +1435,44 @@ AlphaNum::AlphaNum(strings::Hex hex) {
// after the area just overwritten. It comes in multiple flavors to minimize
// call overhead.
static
char
*
Append1
(
char
*
out
,
const
AlphaNum
&
x
)
{
memcpy
(
out
,
x
.
data
(),
x
.
size
());
return
out
+
x
.
size
();
if
(
x
.
size
()
>
0
)
{
memcpy
(
out
,
x
.
data
(),
x
.
size
());
out
+=
x
.
size
();
}
return
out
;
}
static
char
*
Append2
(
char
*
out
,
const
AlphaNum
&
x1
,
const
AlphaNum
&
x2
)
{
memcpy
(
out
,
x1
.
data
(),
x1
.
size
());
out
+=
x1
.
size
();
memcpy
(
out
,
x2
.
data
(),
x2
.
size
());
return
out
+
x2
.
size
();
if
(
x1
.
size
()
>
0
)
{
memcpy
(
out
,
x1
.
data
(),
x1
.
size
());
out
+=
x1
.
size
();
}
if
(
x2
.
size
()
>
0
)
{
memcpy
(
out
,
x2
.
data
(),
x2
.
size
());
out
+=
x2
.
size
();
}
return
out
;
}
static
char
*
Append4
(
char
*
out
,
const
AlphaNum
&
x1
,
const
AlphaNum
&
x2
,
static
char
*
Append4
(
char
*
out
,
const
AlphaNum
&
x1
,
const
AlphaNum
&
x2
,
const
AlphaNum
&
x3
,
const
AlphaNum
&
x4
)
{
memcpy
(
out
,
x1
.
data
(),
x1
.
size
());
out
+=
x1
.
size
();
memcpy
(
out
,
x2
.
data
(),
x2
.
size
());
out
+=
x2
.
size
();
memcpy
(
out
,
x3
.
data
(),
x3
.
size
());
out
+=
x3
.
size
();
memcpy
(
out
,
x4
.
data
(),
x4
.
size
());
return
out
+
x4
.
size
();
if
(
x1
.
size
()
>
0
)
{
memcpy
(
out
,
x1
.
data
(),
x1
.
size
());
out
+=
x1
.
size
();
}
if
(
x2
.
size
()
>
0
)
{
memcpy
(
out
,
x2
.
data
(),
x2
.
size
());
out
+=
x2
.
size
();
}
if
(
x3
.
size
()
>
0
)
{
memcpy
(
out
,
x3
.
data
(),
x3
.
size
());
out
+=
x3
.
size
();
}
if
(
x4
.
size
()
>
0
)
{
memcpy
(
out
,
x4
.
data
(),
x4
.
size
());
out
+=
x4
.
size
();
}
return
out
;
}
string
StrCat
(
const
AlphaNum
&
a
,
const
AlphaNum
&
b
)
{
...
...
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