diff options
Diffstat (limited to 'common_video/h264/sps_parser.cc')
-rw-r--r-- | common_video/h264/sps_parser.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common_video/h264/sps_parser.cc b/common_video/h264/sps_parser.cc index 2be6da2274..c921972ce0 100644 --- a/common_video/h264/sps_parser.cc +++ b/common_video/h264/sps_parser.cc @@ -17,6 +17,7 @@ #include "rtc_base/bitbuffer.h" #include "rtc_base/logging.h" +namespace { typedef rtc::Optional<webrtc::SpsParser::SpsState> OptionalSps; #define RETURN_EMPTY_ON_FAIL(x) \ @@ -24,6 +25,10 @@ typedef rtc::Optional<webrtc::SpsParser::SpsState> OptionalSps; return OptionalSps(); \ } +constexpr int kScalingDeltaMin = -128; +constexpr int kScaldingDeltaMax = 127; +} // namespace + namespace webrtc { SpsParser::SpsState::SpsState() = default; @@ -115,6 +120,8 @@ rtc::Optional<SpsParser::SpsState> SpsParser::ParseSpsUpToVui( // delta_scale: se(v) RETURN_EMPTY_ON_FAIL( buffer->ReadSignedExponentialGolomb(&delta_scale)); + RETURN_EMPTY_ON_FAIL(delta_scale >= kScalingDeltaMin && + delta_scale <= kScaldingDeltaMax); next_scale = (last_scale + delta_scale + 256) % 256; } if (next_scale != 0) |