Detect and reject illegal RTP header extension modifications.

This is somewhat klugey, because it does the same checks at two
different layers in the stack, in different functions, which runs
the risk of making them out of sync. But it solves the immediate
problem.

Bug: chromium:1249753
Change-Id: I2ad96f0cc9499c15540ff6946a409b40df3e3925
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235826
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35259}
This commit is contained in:
Harald Alvestrand
2021-10-21 22:37:50 +00:00
committed by WebRTC LUCI CQ
parent ac9a288274
commit b62ee8ce94
8 changed files with 121 additions and 38 deletions

View File

@ -154,7 +154,12 @@ bool RtpHeaderExtensionMap::Register(int id,
<< static_cast<int>(registered_type);
return false;
}
RTC_DCHECK(!IsRegistered(type));
if (IsRegistered(type)) {
RTC_LOG(LS_WARNING) << "Illegal reregistration for uri: " << uri
<< " is previously registered with id " << GetId(type)
<< " and cannot be reregistered with id " << id;
return false;
}
// There is a run-time check above id fits into uint8_t.
ids_[type] = static_cast<uint8_t>(id);