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

[core]<BUG> Fixed wrong filling group data #1412

Merged
merged 1 commit into from
Jul 30, 2020
Merged
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
23 changes: 18 additions & 5 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12640,21 +12640,34 @@ void CUDTGroup::fillGroupData(
const SRT_MSGCTRL& in // MSGCTRL read from the data-providing socket
)
{
// Preserve the data that will be overwritten by assignment
SRT_SOCKGROUPDATA* grpdata = w_out.grpdata;
size_t grpdata_size = w_out.grpdata_size;

w_out = in; // NOTE: This will write NULL to grpdata and 0 to grpdata_size!

w_out.grpdata = NULL; // Make sure it's done, for any case
w_out.grpdata_size = 0;

// User did not wish to read the group data at all.
if (!grpdata)
{
w_out.grpdata = NULL;
w_out.grpdata_size = 0;
return;
}

int st = getGroupData((grpdata), (&w_out.grpdata_size));
// On error, rewrite NULL.
w_out.grpdata = st != SRT_ERROR ? grpdata : NULL;
int st = getGroupData((grpdata), (&grpdata_size));

// Always write back the size, no matter if the data were filled.
w_out.grpdata_size = grpdata_size;

if (st == SRT_ERROR)
{
// Keep NULL in grpdata
return;
}

// Write back original data
w_out.grpdata = grpdata;
}

struct FLookupSocketWithEvent
Expand Down