Skip to content

Commit

Permalink
hobbes::variant tag become invalid causes buffer overrun during destr…
Browse files Browse the repository at this point in the history
…uction calls
  • Loading branch information
mo-xiaoming committed Jul 6, 2022
1 parent fc1bf3b commit a2c0d38
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 a2c0d38

Please sign in to comment.