Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2072)

Unified Diff: webrtc/pc/webrtcsdp.cc

Issue 2675273003: Fixing SDP parsing crash due to invalid port numbers. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/socketaddress.h ('k') | webrtc/pc/webrtcsdp_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/webrtcsdp.cc
diff --git a/webrtc/pc/webrtcsdp.cc b/webrtc/pc/webrtcsdp.cc
index 11eefe5c3d5098f88ce8a884c5535d7dd14248cf..4a190c7663654dcc24dd82c270c84c0bb68f360e 100644
--- a/webrtc/pc/webrtcsdp.cc
+++ b/webrtc/pc/webrtcsdp.cc
@@ -1026,6 +1026,9 @@ bool ParseCandidate(const std::string& message, Candidate* candidate,
if (!GetValueFromString(first_line, fields[5], &port, error)) {
return false;
}
+ if (port < 0 || port > 65535) {
+ return ParseFailed(first_line, "Invalid port number.", error);
+ }
SocketAddress address(connection_address, port);
cricket::ProtocolType protocol;
@@ -1072,6 +1075,9 @@ bool ParseCandidate(const std::string& message, Candidate* candidate,
first_line, fields[++current_position], &port, error)) {
return false;
}
+ if (port < 0 || port > 65535) {
pthatcher1 2017/02/10 18:13:33 Might as well make an IsValidPort() function.
Taylor Brandstetter 2017/02/10 19:25:30 Done.
+ return ParseFailed(first_line, "Invalid port number.", error);
+ }
related_address.SetPort(port);
++current_position;
}
« no previous file with comments | « webrtc/base/socketaddress.h ('k') | webrtc/pc/webrtcsdp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698