Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1783)

Unified Diff: webrtc/common_video/h264/pps_parser.cc

Issue 2532973002: Sanity check parsed QP values from H264 bitstream (Closed)
Patch Set: Add check to PPS parser as well Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/common_video/h264/pps_parser.cc
diff --git a/webrtc/common_video/h264/pps_parser.cc b/webrtc/common_video/h264/pps_parser.cc
index 0215549959e39be2d224090539f29938c096a486..3eb1e9b1973cf6d0617b4e5148f5c6b0e1e91ac7 100644
--- a/webrtc/common_video/h264/pps_parser.cc
+++ b/webrtc/common_video/h264/pps_parser.cc
@@ -22,6 +22,10 @@
return rtc::Optional<PpsParser::PpsState>(); \
}
+namespace {
+int kMaxAbsPicInitQpDeltaValue = 25;
magjed_webrtc 2016/11/29 10:34:32 nit: const
+}
+
namespace webrtc {
// General note: this is based off the 02/2014 version of the H.264 standard.
@@ -162,6 +166,10 @@ rtc::Optional<PpsParser::PpsState> PpsParser::ParseInternal(
// pic_init_qp_minus26: se(v)
RETURN_EMPTY_ON_FAIL(
bit_buffer->ReadSignedExponentialGolomb(&pps.pic_init_qp_minus26));
+ // Sanity-check parsed value
+ if (abs(pps.pic_init_qp_minus26) > kMaxAbsPicInitQpDeltaValue) {
+ RETURN_EMPTY_ON_FAIL(false);
+ }
// pic_init_qs_minus26: se(v)
RETURN_EMPTY_ON_FAIL(bit_buffer->ReadExponentialGolomb(&golomb_ignored));
// chroma_qp_index_offset: se(v)

Powered by Google App Engine
This is Rietveld 408576698