Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
cpp-libs
actor-incubator
Commits
c6384b90
Commit
c6384b90
authored
Jan 07, 2020
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix undefined behavior due to bad memory alignment
parent
5106b9f9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
libcaf_net/src/header.cpp
libcaf_net/src/header.cpp
+4
-2
No files found.
libcaf_net/src/header.cpp
View file @
c6384b90
...
@@ -49,9 +49,11 @@ header header::from_bytes(span<const byte> bytes) {
...
@@ -49,9 +49,11 @@ header header::from_bytes(span<const byte> bytes) {
header
result
;
header
result
;
auto
ptr
=
bytes
.
data
();
auto
ptr
=
bytes
.
data
();
result
.
type
=
*
reinterpret_cast
<
const
message_type
*>
(
ptr
);
result
.
type
=
*
reinterpret_cast
<
const
message_type
*>
(
ptr
);
auto
payload_len
=
*
reinterpret_cast
<
const
uint32_t
*>
(
ptr
+
1
);
uint32_t
payload_len
=
0
;
memcpy
(
&
payload_len
,
ptr
+
1
,
4
);
result
.
payload_len
=
detail
::
from_network_order
(
payload_len
);
result
.
payload_len
=
detail
::
from_network_order
(
payload_len
);
auto
operation_data
=
*
reinterpret_cast
<
const
uint64_t
*>
(
ptr
+
5
);
uint64_t
operation_data
;
memcpy
(
&
operation_data
,
ptr
+
5
,
8
);
result
.
operation_data
=
detail
::
from_network_order
(
operation_data
);
result
.
operation_data
=
detail
::
from_network_order
(
operation_data
);
return
result
;
return
result
;
}
}
...
...
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