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

Unified Diff: webrtc/modules/video_coding/decoding_state.cc

Issue 2534883003: Added sanity check to VCMDecodingState::UsingFlexibleMode to prevent OOB error. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/decoding_state.cc
diff --git a/webrtc/modules/video_coding/decoding_state.cc b/webrtc/modules/video_coding/decoding_state.cc
index 229555287c826a6c8f9a9b99588e5cda53a5ddda..0c45ae3b397583f3cf13472a90ebedb721b2844b 100644
--- a/webrtc/modules/video_coding/decoding_state.cc
+++ b/webrtc/modules/video_coding/decoding_state.cc
@@ -291,8 +291,15 @@ bool VCMDecodingState::UsingPictureId(const VCMFrameBuffer* frame) const {
}
bool VCMDecodingState::UsingFlexibleMode(const VCMFrameBuffer* frame) const {
- return frame->CodecSpecific()->codecType == kVideoCodecVP9 &&
- frame->CodecSpecific()->codecSpecific.VP9.flexible_mode;
+ bool is_flexible_mode =
+ frame->CodecSpecific()->codecType == kVideoCodecVP9 &&
+ frame->CodecSpecific()->codecSpecific.VP9.flexible_mode;
+ if (is_flexible_mode && frame->PictureId() == kNoPictureId) {
+ LOG(LS_WARNING) << "Frame is marked as using flexible mode but no"
+ << "picture id is set.";
+ return false;
+ }
+ return is_flexible_mode;
}
// TODO(philipel): change how check work, this check practially
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698