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

Unified Diff: webrtc/api/webrtcsdp.cc

Issue 2571073002: Fixing integer overflow when parsing bandwidth attribute. (Closed)
Patch Set: Created 4 years 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 | « no previous file | webrtc/api/webrtcsdp_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/webrtcsdp.cc
diff --git a/webrtc/api/webrtcsdp.cc b/webrtc/api/webrtcsdp.cc
index 69a1af28adc70a077d73a10e09bb6bf663283b83..e39c350023d1d393ad80a5d96fc50bc2b52ebbcd 100644
--- a/webrtc/api/webrtcsdp.cc
+++ b/webrtc/api/webrtcsdp.cc
@@ -2597,7 +2597,8 @@ bool ParseContent(const std::string& message,
<< cricket::kDataMaxBandwidth / 1000 << "kbps.";
return ParseFailed(line, description.str(), error);
}
- media_desc->set_bandwidth(b * 1000);
+ // Prevent integer overflow.
+ media_desc->set_bandwidth(b < INT_MAX / 1000 ? b * 1000 : INT_MAX);
pthatcher1 2016/12/13 23:58:05 Can you put a paren around the thing before "?"?
Taylor Brandstetter 2016/12/14 00:17:01 Done (but using std::min).
}
}
continue;
« no previous file with comments | « no previous file | webrtc/api/webrtcsdp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698