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

Unified Diff: chrome/browser/media/cast_remoting_connector_messaging.cc

Issue 2567263002: Fix Media Remoting Connector stream ID message parsing. (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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/cast_remoting_connector_messaging.cc
diff --git a/chrome/browser/media/cast_remoting_connector_messaging.cc b/chrome/browser/media/cast_remoting_connector_messaging.cc
index 40682e379258674585f97cc31c9340c73c28922a..d55d6a5f8bcdc2180d632facc2be1d5edd1e3ae5 100644
--- a/chrome/browser/media/cast_remoting_connector_messaging.cc
+++ b/chrome/browser/media/cast_remoting_connector_messaging.cc
@@ -50,10 +50,9 @@ int32_t CastRemotingConnectorMessaging::GetStreamIdFromStartedMessage(
start += specifier.size();
if (start + 1 >= message.size())
return -1; // Must be at least one hex digit following the specifier.
+ const auto length = message.find(kMessageFieldSeparator, start) - start;
int parsed_value;
- if (!base::HexStringToInt(
- message.substr(start, message.find(kMessageFieldSeparator, start)),
- &parsed_value) ||
+ if (!base::HexStringToInt(message.substr(start, length), &parsed_value) ||
parsed_value < 0 ||
parsed_value > std::numeric_limits<int32_t>::max()) {
return -1; // Non-hex digits, or outside valid range.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698