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

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: Android compile issues 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 | « media/cdm/cenc_utils.cc ('k') | media/formats/mp4/box_reader.h » ('j') | no next file with comments »
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 3174e7f38bfa6da3d22625f2992eca834241041f..ae9316e0ef09aa4f4154c4977f7bb8c8ebe081e5 100644
--- a/media/cdm/cenc_utils_unittest.cc
+++ b/media/cdm/cenc_utils_unittest.cc
@@ -522,4 +522,31 @@ TEST_F(CencUtilsTest, GetPsshData_MultiplePssh) {
EXPECT_EQ(data1, pssh_data);
EXPECT_NE(data2, pssh_data);
}
+
+TEST_F(CencUtilsTest, NonPsshData) {
+ // Create a non-'pssh' box.
+ const uint8_t data[] = {
+ 0x00, 0x00, 0x00, 0x08, // size = 8
+ 'p', 's', 's', 'g'
+ };
+ std::vector<uint8_t> non_pssh_box(data, data + arraysize(data));
+ EXPECT_FALSE(ValidatePsshInput(non_pssh_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(), non_pssh_box.begin(), non_pssh_box.end());
+ EXPECT_FALSE(ValidatePsshInput(boxes));
+
+ // Repeat with |non_pssh_box| first.
+ boxes.clear();
+ boxes.insert(boxes.end(), non_pssh_box.begin(), non_pssh_box.end());
+ boxes.insert(boxes.end(), pssh_box.begin(), pssh_box.end());
+ EXPECT_FALSE(ValidatePsshInput(boxes));
+}
+
} // namespace media
« no previous file with comments | « media/cdm/cenc_utils.cc ('k') | media/formats/mp4/box_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698