fix: -Wunsafe-buffer-usage warning in V8Serializer::Serialize() (#43676)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
017ba5bf46
commit
5b933e941e
1 changed files with 5 additions and 3 deletions
|
@ -49,10 +49,12 @@ class V8Serializer : public v8::ValueSerializer::Delegate {
|
||||||
}
|
}
|
||||||
DCHECK(wrote_value);
|
DCHECK(wrote_value);
|
||||||
|
|
||||||
std::pair<uint8_t*, size_t> buffer = serializer_.Release();
|
const auto [data_bytes, data_len] = serializer_.Release();
|
||||||
DCHECK_EQ(buffer.first, data_.data());
|
DCHECK_EQ(std::data(data_), data_bytes);
|
||||||
out->encoded_message = base::make_span(buffer.first, buffer.second);
|
DCHECK_GE(std::size(data_), data_len);
|
||||||
|
data_.resize(data_len);
|
||||||
out->owned_encoded_message = std::move(data_);
|
out->owned_encoded_message = std::move(data_);
|
||||||
|
out->encoded_message = out->owned_encoded_message;
|
||||||
out->sender_agent_cluster_id =
|
out->sender_agent_cluster_id =
|
||||||
blink::WebMessagePort::GetEmbedderAgentClusterID();
|
blink::WebMessagePort::GetEmbedderAgentClusterID();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue