Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++: Fix DataProducer::Send invalid memory access #1190

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion node/src/tests/test-DirectTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ test('dataProducer.send() succeeds', async () =>
expect(ppid).toBe(53); // PPID of WebRTC DataChannel binary.
}

expect(id).toBe(++lastRecvMessageId);
++lastRecvMessageId;
});
});

Expand Down
2 changes: 0 additions & 2 deletions rust/tests/integration/direct_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ fn get_stats_succeeds() {
}

#[test]
#[ignore]
fn send_succeeds() {
future::block_on(async move {
let (_worker, _router, transport) = init().await;
Expand Down Expand Up @@ -226,7 +225,6 @@ fn send_succeeds() {
}

last_recv_message_id.fetch_add(1, Ordering::SeqCst);
assert_eq!(id, last_recv_message_id.load(Ordering::SeqCst));

if id == num_messages {
let _ = received_messages_tx.lock().take().unwrap().send(());
Expand Down
11 changes: 7 additions & 4 deletions worker/src/RTC/DataProducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,14 @@ namespace RTC

std::vector<uint16_t> subchannels;

subchannels.reserve(body->subchannels()->size());
jmillan marked this conversation as resolved.
Show resolved Hide resolved

for (const auto subchannel : *body->subchannels())
if (flatbuffers::IsFieldPresent(body, FBS::DataProducer::SendNotification::VT_SUBCHANNELS))
{
subchannels.emplace_back(subchannel);
subchannels.reserve(body->subchannels()->size());

for (const auto subchannel : *body->subchannels())
{
subchannels.emplace_back(subchannel);
}
}

std::optional<uint16_t> requiredSubchannel{ std::nullopt };
Expand Down
Loading