Index: webrtc/modules/rtp_rtcp/source/rtp_packet.h |
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet.h b/webrtc/modules/rtp_rtcp/source/rtp_packet.h |
index ca189dbe0d23bbe0c8f9da3dacf7649425aed235..0901fc2506270538c8297e840153c64a0a2181b8 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet.h |
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet.h |
@@ -183,7 +183,10 @@ bool Packet::GetExtension(Values... values) const { |
template <typename Extension, typename... Values> |
bool Packet::SetExtension(Values... values) { |
- auto buffer = AllocateExtension(Extension::kId, Extension::kValueSizeBytes); |
+ const size_t value_size = Extension::ValueSize(values...); |
+ if (value_size == 0 || value_size > 16) |
+ return false; |
+ auto buffer = AllocateExtension(Extension::kId, value_size); |
if (buffer.empty()) |
return false; |
return Extension::Write(buffer.data(), values...); |