Stop parsing if current message length is bigger than buffer.
If allow_incomplete_logs_ is false and the current message length is bigger than the remaining buffer, this CL returns an error status to the client. Bug: None Change-Id: Idcacda9f42429416da3272651621b8d5936fc69e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225545 Reviewed-by: Björn Terelius <terelius@webrtc.org> Reviewed-by: Elad Alon <eladalon@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34500}
This commit is contained in:
parent
f39c1708a2
commit
0786b52c2e
@ -1311,12 +1311,17 @@ ParsedRtcEventLog::ParseStatus ParsedRtcEventLog::ParseStreamInternal(
|
||||
}
|
||||
|
||||
if (message_length > s.size()) {
|
||||
RTC_LOG(LS_WARNING) << "Protobuf message length is too large.";
|
||||
RTC_LOG(LS_WARNING) << "Protobuf message length is larger than the "
|
||||
"remaining bytes in the proto.";
|
||||
RTC_PARSE_WARN_AND_RETURN_SUCCESS_IF(allow_incomplete_logs_,
|
||||
kIncompleteLogError);
|
||||
RTC_PARSE_CHECK_OR_RETURN_LE(message_length, kMaxEventSize);
|
||||
return ParseStatus::Error(
|
||||
"Incomplete message: the length of the next message is larger than "
|
||||
"the remaining bytes in the proto",
|
||||
__FILE__, __LINE__);
|
||||
}
|
||||
|
||||
RTC_PARSE_CHECK_OR_RETURN_LE(message_length, kMaxEventSize);
|
||||
// Skip forward to the start of the next event.
|
||||
s = s.substr(message_length);
|
||||
size_t total_event_size = event_start.size() - s.size();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user