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
628fdab2
Commit
628fdab2
authored
Nov 24, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix undefined behavior in intrusive task list
parent
7bc60af3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
19 deletions
+6
-19
libcaf_core/caf/intrusive/forward_iterator.hpp
libcaf_core/caf/intrusive/forward_iterator.hpp
+2
-2
libcaf_core/caf/intrusive/task_queue.hpp
libcaf_core/caf/intrusive/task_queue.hpp
+4
-15
libcaf_core/test/intrusive/drr_queue.cpp
libcaf_core/test/intrusive/drr_queue.cpp
+0
-1
libcaf_core/test/intrusive/task_queue.cpp
libcaf_core/test/intrusive/task_queue.cpp
+0
-1
No files found.
libcaf_core/caf/intrusive/forward_iterator.hpp
View file @
628fdab2
...
...
@@ -84,13 +84,13 @@ public:
// -- operators --------------------------------------------------------------
forward_iterator
&
operator
++
()
{
ptr
=
p
romote
(
ptr
->
next
)
;
ptr
=
p
tr
->
next
;
return
*
this
;
}
forward_iterator
operator
++
(
int
)
{
forward_iterator
res
=
*
this
;
ptr
=
p
romote
(
ptr
->
next
)
;
ptr
=
p
tr
->
next
;
return
res
;
}
...
...
libcaf_core/caf/intrusive/task_queue.hpp
View file @
628fdab2
...
...
@@ -173,10 +173,8 @@ public:
/// @private
task_size_type
next_task_size
()
const
noexcept
{
if
(
head_
.
next
==
nullptr
)
return
0
;
auto
ptr
=
promote
(
head_
.
next
);
return
policy_
.
task_size
(
*
ptr
);
auto
ptr
=
head_
.
next
;
return
ptr
!=
&
tail_
?
policy_
.
task_size
(
*
promote
(
ptr
))
:
0
;
}
/// @private
...
...
@@ -203,16 +201,6 @@ public:
// -- iterator access --------------------------------------------------------
/// Returns an iterator to the dummy before the first element.
iterator
before_begin
()
noexcept
{
return
&
head_
;
}
/// Returns an iterator to the dummy before the first element.
const_iterator
before_begin
()
const
noexcept
{
return
&
head_
;
}
/// Returns an iterator to the dummy before the first element.
iterator
begin
()
noexcept
{
return
head_
.
next
;
...
...
@@ -252,6 +240,7 @@ public:
/// Returns a pointer to the last element.
pointer
back
()
noexcept
{
CAF_ASSERT
(
head_
.
next
!=
&
tail_
);
return
promote
(
tail_
.
next
);
}
...
...
@@ -319,7 +308,7 @@ public:
/// @private
void
lifo_append
(
node_pointer
ptr
)
{
if
(
old_last_
==
nullptr
)
{
old_last_
=
back
()
;
old_last_
=
tail_
.
next
;
push_back
(
promote
(
ptr
));
}
else
{
ptr
->
next
=
new_head_
;
...
...
libcaf_core/test/intrusive/drr_queue.cpp
View file @
628fdab2
...
...
@@ -87,7 +87,6 @@ CAF_TEST(default_constructed) {
CAF_REQUIRE_EQUAL
(
queue
.
peek
(),
nullptr
);
CAF_REQUIRE_EQUAL
(
queue
.
next
(),
nullptr
);
CAF_REQUIRE_EQUAL
(
queue
.
begin
(),
queue
.
end
());
CAF_REQUIRE_EQUAL
(
queue
.
before_begin
()
->
next
,
queue
.
end
().
ptr
);
}
CAF_TEST
(
inc_deficit
)
{
...
...
libcaf_core/test/intrusive/task_queue.cpp
View file @
628fdab2
...
...
@@ -83,7 +83,6 @@ CAF_TEST(default_constructed) {
CAF_REQUIRE_EQUAL
(
queue
.
total_task_size
(),
0
);
CAF_REQUIRE_EQUAL
(
queue
.
peek
(),
nullptr
);
CAF_REQUIRE_EQUAL
(
queue
.
begin
(),
queue
.
end
());
CAF_REQUIRE_EQUAL
(
queue
.
before_begin
()
->
next
,
queue
.
end
().
ptr
);
}
CAF_TEST
(
push_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