Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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 Framework
Commits
c13c4b7b
Commit
c13c4b7b
authored
Oct 29, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of char pointers in deep_to_string
parent
d6bc6cc6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
CHANGELOG.md
CHANGELOG.md
+5
-0
libcaf_core/caf/detail/stringification_inspector.hpp
libcaf_core/caf/detail/stringification_inspector.hpp
+8
-5
libcaf_core/src/detail/stringification_inspector.cpp
libcaf_core/src/detail/stringification_inspector.cpp
+0
-4
No files found.
CHANGELOG.md
View file @
c13c4b7b
...
...
@@ -30,6 +30,11 @@ is based on [Keep a Changelog](https://keepachangelog.com).
-
CAF 0.18 added support for
`make_behavior`
in state classes. However, CAF
erroneously picked this member function over running the function body when
spawning function-based actors (#1149).
-
When passing
`nullptr`
or custom types with implicit conversions to
`const char*`
to
`deep_to_string`
, CAF could run into a segfault in the former
case or do unexpected things in the latter case. The stringification inspector
now matches precisely on pointer types to stop the compiler from doing
implicit conversions in the first place.
## [0.18.0-rc.1] - 2020-09-09
...
...
libcaf_core/caf/detail/stringification_inspector.hpp
View file @
c13c4b7b
...
...
@@ -19,6 +19,7 @@
#pragma once
#include <chrono>
#include <cstring>
#include <string>
#include <type_traits>
#include <vector>
...
...
@@ -174,18 +175,20 @@ public:
return
true
;
}
bool
builtin_inspect
(
const
char
*
x
);
template
<
class
T
>
bool
builtin_inspect
(
const
T
*
x
)
{
sep
();
if
(
!
x
)
{
if
(
x
==
nullptr
)
{
sep
();
result_
+=
"null"
;
return
true
;
}
else
if
constexpr
(
std
::
is_same
<
T
,
char
>::
value
)
{
return
value
(
string_view
{
x
,
strlen
(
x
)});
}
else
{
sep
();
result_
+=
'*'
;
save_value
(
*
this
,
detail
::
as_mutable_ref
(
*
x
));
return
true
;
}
return
true
;
}
template
<
class
T
>
...
...
libcaf_core/src/detail/stringification_inspector.cpp
View file @
c13c4b7b
...
...
@@ -235,10 +235,6 @@ bool stringification_inspector::value(const std::vector<bool>& xs) {
return
end_sequence
();
}
bool
stringification_inspector
::
builtin_inspect
(
const
char
*
x
)
{
return
value
(
string_view
{
x
,
strlen
(
x
)});
}
void
stringification_inspector
::
sep
()
{
if
(
!
result_
.
empty
())
switch
(
result_
.
back
())
{
...
...
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