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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.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, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 int bytes_left = mapper.size(); 411 int bytes_left = mapper.size();
412 412
413 do { 413 do {
414 int64 timestamp = 0; 414 int64 timestamp = 0;
415 int64 frame_size = -1; 415 int64 frame_size = -1;
416 const int kHeaderSize = sizeof(timestamp) + sizeof(frame_size); 416 const int kHeaderSize = sizeof(timestamp) + sizeof(frame_size);
417 417
418 if (bytes_left < kHeaderSize) 418 if (bytes_left < kHeaderSize)
419 return false; 419 return false;
420 420
421 timestamp = *(reinterpret_cast<const int64*>(cur)); 421 memcpy(&timestamp, cur, sizeof(timestamp));
422 cur += sizeof(timestamp); 422 cur += sizeof(timestamp);
423 bytes_left -= sizeof(timestamp); 423 bytes_left -= sizeof(timestamp);
424 424
425 frame_size = *(reinterpret_cast<const int64*>(cur)); 425 memcpy(&frame_size, cur, sizeof(frame_size));
426 cur += sizeof(frame_size); 426 cur += sizeof(frame_size);
427 bytes_left -= sizeof(frame_size); 427 bytes_left -= sizeof(frame_size);
428 428
429 // We should *not* have empty frame in the list. 429 // We should *not* have empty frame in the list.
430 if (frame_size <= 0 || bytes_left < frame_size) 430 if (frame_size <= 0 || bytes_left < frame_size)
431 return false; 431 return false;
432 432
433 scoped_refptr<media::DataBuffer> frame(new media::DataBuffer(cur, 433 scoped_refptr<media::DataBuffer> frame(new media::DataBuffer(cur,
434 frame_size)); 434 frame_size));
435 frame->SetTimestamp(base::TimeDelta::FromMicroseconds(timestamp)); 435 frame->SetTimestamp(base::TimeDelta::FromMicroseconds(timestamp));
(...skipping 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after
3208 screen_size_for_fullscreen_ = gfx::Size(); 3208 screen_size_for_fullscreen_ = gfx::Size();
3209 WebElement element = container_->element(); 3209 WebElement element = container_->element();
3210 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 3210 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
3211 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 3211 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
3212 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 3212 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
3213 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 3213 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
3214 } 3214 }
3215 3215
3216 } // namespace ppapi 3216 } // namespace ppapi
3217 } // namespace webkit 3217 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698