提交 dfe1cb12 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Fix crash if given fingerprints array in webrtcTransport.connect() is empty

Fixes #537
上级 2bdcbb12
......@@ -314,6 +314,16 @@ test('webRtcTransport.connect() with wrong arguments rejects with TypeError', as
role : 'chicken'
};
await expect(transport.connect({ dtlsParameters: dtlsRemoteParameters }))
.rejects
.toThrow(TypeError);
dtlsRemoteParameters =
{
fingerprints : [],
role : 'chicken'
};
await expect(transport.connect({ dtlsParameters: dtlsRemoteParameters }))
.rejects
.toThrow(TypeError);
......
......@@ -448,7 +448,13 @@ namespace RTC
auto jsonFingerprintsIt = jsonDtlsParametersIt->find("fingerprints");
if (jsonFingerprintsIt == jsonDtlsParametersIt->end() || !jsonFingerprintsIt->is_array())
{
MS_THROW_TYPE_ERROR("missing dtlsParameters.fingerprints");
}
else if (jsonFingerprintsIt->empty())
{
MS_THROW_TYPE_ERROR("empty dtlsParameters.fingerprints array");
}
// NOTE: Just take the first fingerprint.
for (auto& jsonFingerprint : *jsonFingerprintsIt)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论