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

Unified Diff: media/webm/webm_cluster_parser.cc

Issue 11139008: Change WebM parser to treat IVs from encrypted WebM as raw data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/webm/webm_cluster_parser.cc
diff --git a/media/webm/webm_cluster_parser.cc b/media/webm/webm_cluster_parser.cc
index fb1c69b874739719169085cbdcf4278862e95a61..6d9ac50b4861db0756f3f715538fa756dc5bad95 100644
--- a/media/webm/webm_cluster_parser.cc
+++ b/media/webm/webm_cluster_parser.cc
@@ -17,9 +17,9 @@ namespace media {
// Generates a 16 byte CTR counter block. The CTR counter block format is a
// CTR IV appended with a CTR block counter. |iv| is an 8 byte CTR IV.
// Returns a string of kDecryptionKeySize bytes.
-static std::string GenerateCounterBlock(uint64 iv) {
- std::string counter_block(reinterpret_cast<char*>(&iv), sizeof(iv));
- counter_block.append(DecryptConfig::kDecryptionKeySize - sizeof(iv), 0);
+static std::string GenerateCounterBlock(const std::string& iv) {
+ std::string counter_block(iv);
+ counter_block.append(DecryptConfig::kDecryptionKeySize - kWebMIvSize, 0);
return counter_block;
}
@@ -237,10 +237,10 @@ bool WebMClusterParser::OnBlock(int track_num, int timecode,
std::string counter_block;
if (signal_byte & kWebMFlagEncryptedFrame) {
- uint64 network_iv;
- memcpy(&network_iv, data + data_offset, sizeof(network_iv));
- data_offset += sizeof(network_iv);
- counter_block = GenerateCounterBlock(base::NetToHost64(network_iv));
+ const std::string iv(reinterpret_cast<const char*>(data + data_offset),
ddorwin 2012/10/13 00:26:17 nit: We create a string just to then copy it to an
fgalligan1 2012/10/13 06:20:31 Done.
+ kWebMIvSize);
+ data_offset += kWebMIvSize;
+ counter_block = GenerateCounterBlock(iv);
}
// TODO(fgalligan): Revisit if DecryptConfig needs to be set on unencrypted

Powered by Google App Engine
This is Rietveld 408576698