Skip to content

Commit

Permalink
[core] Fixed nonchecked empty config for packetfilter (#3031).
Browse files Browse the repository at this point in the history
  • Loading branch information
ethouris committed Sep 26, 2024
1 parent 7a4f5e2 commit a7b3711
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions srtcore/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@ bool SrtParseConfig(const string& s, SrtConfig& w_config)

vector<string> parts;
Split(s, ',', back_inserter(parts));
if (parts.empty())
return false;

w_config.type = parts[0];

Expand Down
4 changes: 3 additions & 1 deletion test/test_fec_rebuilding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ TEST(TestFEC, ConfigExchange)

char fec_config1 [] = "fec,cols:10,rows:10";

srt_setsockflag(sid1, SRTO_PACKETFILTER, fec_config1, (sizeof fec_config1)-1);
// Check empty configuration first
EXPECT_EQ(srt_setsockflag(sid1, SRTO_PACKETFILTER, "", 0), -1);
EXPECT_NE(srt_setsockflag(sid1, SRTO_PACKETFILTER, fec_config1, (sizeof fec_config1)-1), -1);

EXPECT_TRUE(m1.checkApplyFilterConfig("fec,cols:10,arq:never"));

Expand Down

0 comments on commit a7b3711

Please sign in to comment.