瀏覽代碼

Properly check input in RTPMap::setMLine()

Paul-Louis Ageneau 4 年之前
父節點
當前提交
76d2d3d97f
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/description.cpp

+ 5 - 0
src/description.cpp

@@ -929,11 +929,16 @@ int Description::Media::RTPMap::parsePT(string_view view) {
 
 void Description::Media::RTPMap::setMLine(string_view mline) {
 	size_t p = mline.find(' ');
+	if (p == string::npos)
+		throw std::invalid_argument("Invalid m-line");
 
 	this->pt = to_integer<int>(mline.substr(0, p));
 
 	string_view line = mline.substr(p + 1);
 	size_t spl = line.find('/');
+	if (spl == string::npos)
+		throw std::invalid_argument("Invalid m-line");
+
 	this->format = line.substr(0, spl);
 
 	line = line.substr(spl + 1);