Skip to content

The LinkedObject::moveIntoList usage is unsafe #11691

@yanavlasov

Description

@yanavlasov

Usage of the LinkedObject::moveIntoList() and LinkedObject::moveIntoListBack() is unsafe. Clang-tidy rightfully complains:

source/common/http/http2/codec_impl.cc:1317:3: error: 'stream' used after it was moved [bugprone-use-after-move,-warnings-as-errors]
  stream->moveIntoList(std::move(stream), active_streams_);
  ^
source/common/http/http2/codec_impl.cc:1317:24: note: move occurred here
  stream->moveIntoList(std::move(stream), active_streams_);
                       ^
source/common/http/http2/codec_impl.cc:1317:3: note: the use and move are unsequenced, i.e. there is no guarantee about the order in which they are evaluated
  stream->moveIntoList(std::move(stream), active_streams_);
  ^

This pattern is used throughout the code. So far compiler generated working code, but it should be cleaned up before we hit this issue in production.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions