Commit 6ec9ba03 authored by miu's avatar miu Committed by Commit bot

Fix Media Remoting Connector stream ID message parsing.

This fixes a bug where the 2nd arg to std::string::substr() was not the
length, but the end position.

Review-Url: https://codereview.chromium.org/2567263002
Cr-Commit-Position: refs/heads/master@{#438015}
parent 2c4e9819
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment