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

Unified Diff: media/cast/receiver/video_decoder.cc

Issue 362123005: Cast: Update simulator tool with more inputs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Diff Created 6 years, 6 months 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: media/cast/receiver/video_decoder.cc
diff --git a/media/cast/receiver/video_decoder.cc b/media/cast/receiver/video_decoder.cc
index 2fd11fe85413071d26bb1a680d7bb34ad23e334f..896cb0a904ca509bf21adf383d829617124c0a8c 100644
--- a/media/cast/receiver/video_decoder.cc
+++ b/media/cast/receiver/video_decoder.cc
@@ -184,9 +184,14 @@ class VideoDecoder::FakeImpl : public VideoDecoder::ImplBase {
virtual ~FakeImpl() {}
virtual scoped_refptr<VideoFrame> Decode(uint8* data, int len) OVERRIDE {
+ // Make sure this is a JSON string.
+ if (!len || data[0] != '{')
+ return NULL;
base::JSONReader reader;
scoped_ptr<base::Value> values(
- reader.Read(base::StringPiece(reinterpret_cast<char*>(data))));
+ reader.Read(base::StringPiece(reinterpret_cast<char*>(data), len)));
+ if (!values)
+ return NULL;
base::DictionaryValue* dict = NULL;
values->GetAsDictionary(&dict);

Powered by Google App Engine
This is Rietveld 408576698