Skip to content

Commit

Permalink
Merge pull request #439 from mo-xiaoming/rpc-leak
Browse files Browse the repository at this point in the history
hobbes::variant tag becomes invalid causes buffer overrun during destruction calls
  • Loading branch information
dawa79 authored Jul 6, 2022
2 parents fc1bf3b + a2c0d38 commit 02eae25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/hobbes/net.H
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,10 @@ template <typename ... Fs>
}
static bool accum(int s, async_read_state* o, tuple<Fs...>* x) {
if (o->template apply<bool, tupAsyncAcc, tuple<Fs...>, int, tuple<Fs...>*>(s, x)) {
++o->unsafeTag();
if (o->unsafeTag() == sizeof...(Fs)) {
if (o->unsafeTag() == sizeof...(Fs)-1) {
return true;
} else {
++o->unsafeTag();
variantApp<void, tupAsyncInit, void, tuple<Fs...>, void*>::apply(o->unsafeTag(), o->unsafePayload(), o->unsafePayload());
return false;
}
Expand Down Expand Up @@ -1013,6 +1013,7 @@ template <typename R, typename ... Args>
this->ks.front()(this->r);
this->ks.pop();
this->r = R();
this->pr = async_read_state();
io<R>::prepare(&this->pr);
return true;
} else {
Expand Down

0 comments on commit 02eae25

Please sign in to comment.