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

Unified Diff: webkit/media/crypto/ppapi/clear_key_cdm.cc

Issue 11304010: Fix type punning error in (de)serializing audio frames. (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: webkit/media/crypto/ppapi/clear_key_cdm.cc
diff --git a/webkit/media/crypto/ppapi/clear_key_cdm.cc b/webkit/media/crypto/ppapi/clear_key_cdm.cc
index dd6a3dc3427cb8d5d342454749d7d7e84c3e7710..17a5f48af98fbb52c02e273086379c4332ff6ae0 100644
--- a/webkit/media/crypto/ppapi/clear_key_cdm.cc
+++ b/webkit/media/crypto/ppapi/clear_key_cdm.cc
@@ -492,9 +492,12 @@ void ClearKeyCdm::GenerateFakeAudioFrames(cdm::AudioFrames* audio_frames) {
const int kHeaderSize = sizeof(timestamp) + sizeof(frame_size);
audio_frames->set_buffer(allocator_->Allocate(kHeaderSize + frame_size));
- int64* data = reinterpret_cast<int64*>(audio_frames->buffer()->data());
- *(data++) = timestamp;
- *(data++) = frame_size;
+ uint8_t* data = audio_frames->buffer()->data();
+
+ memcpy(data, &timestamp, sizeof(timestamp));
+ data += sizeof(timestamp);
+ memcpy(data, &frame_size, sizeof(frame_size));
+ data += sizeof(frame_size);
// You won't hear anything because we have all zeros here. But the video
// should play just fine!
memset(data, 0, frame_size);

Powered by Google App Engine
This is Rietveld 408576698