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

Unified Diff: media/cdm/cenc_utils_unittest.cc

Issue 1189073004: Properly verify that input data is just 'pssh' boxes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | media/formats/mp4/box_definitions.cc » ('j') | media/formats/mp4/box_definitions.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cdm/cenc_utils_unittest.cc
diff --git a/media/cdm/cenc_utils_unittest.cc b/media/cdm/cenc_utils_unittest.cc
index 3bc55ccda7ca37b1f8b16b7a718cf0c4f0190dda..21e24faab576106f120133c569e1cb8b3ad6f4fb 100644
--- a/media/cdm/cenc_utils_unittest.cc
+++ b/media/cdm/cenc_utils_unittest.cc
@@ -512,4 +512,30 @@ TEST_F(CencUtilsTest, GetPsshData_MultiplePssh) {
EXPECT_EQ(data1, pssh_data);
EXPECT_NE(data2, pssh_data);
}
+
+TEST_F(CencUtilsTest, NonPsshData) {
+ const uint8_t data[] = {
+ 0x00, 0x00, 0x00, 0x08, // size = 8
+ 'f', 'r', 'e', 'e'
ddorwin 2015/06/25 23:08:17 Perhaps p s s g, to ensure all bytes are being che
jrummell 2015/06/30 00:06:03 Done.
+ };
+ std::vector<uint8_t> free_box(data, data + arraysize(data));
+ EXPECT_FALSE(ValidatePsshInput(free_box));
+
+ // Make a valid 'pssh' box.
+ std::vector<uint8_t> pssh_box = MakePSSHBox(1, Key1());
+ EXPECT_TRUE(ValidatePsshInput(pssh_box));
+
+ // Concatentate the boxes together (|pssh_box| first).
+ std::vector<uint8_t> boxes;
+ boxes.insert(boxes.end(), pssh_box.begin(), pssh_box.end());
+ boxes.insert(boxes.end(), free_box.begin(), free_box.end());
+ EXPECT_FALSE(ValidatePsshInput(boxes));
+
+ // Repeat with |free_box| first.
+ boxes.clear();
+ boxes.insert(boxes.end(), free_box.begin(), free_box.end());
+ boxes.insert(boxes.end(), pssh_box.begin(), pssh_box.end());
+ EXPECT_FALSE(ValidatePsshInput(boxes));
+}
+
} // namespace media
« no previous file with comments | « no previous file | media/formats/mp4/box_definitions.cc » ('j') | media/formats/mp4/box_definitions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698