From 0231e801d674024cc52c35f0d600c6186d5a9cc4 Mon Sep 17 00:00:00 2001 From: "jiayl@webrtc.org" Date: Wed, 26 Feb 2014 18:54:57 +0000 Subject: [PATCH] Invalidate the whole screen when the frame size is changed. Otherwise we'll compare frames of different sizes and read into invalid memory. BUG=https://code.google.com/p/chromium/issues/detail?id=345498 R=sergeyu@chromium.org Review URL: https://webrtc-codereview.appspot.com/9149004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5614 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/desktop_capture/screen_capturer_win.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/desktop_capture/screen_capturer_win.cc b/webrtc/modules/desktop_capture/screen_capturer_win.cc index 8ae755a41f..db0a57c033 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_win.cc +++ b/webrtc/modules/desktop_capture/screen_capturer_win.cc @@ -169,7 +169,7 @@ void ScreenCapturerWin::Capture(const DesktopRegion& region) { const DesktopFrame* current_frame = queue_.current_frame(); const DesktopFrame* last_frame = queue_.previous_frame(); - if (last_frame) { + if (last_frame && last_frame->size().equals(current_frame->size())) { // Make sure the differencer is set up correctly for these previous and // current screens. if (!differ_.get() || @@ -188,7 +188,8 @@ void ScreenCapturerWin::Capture(const DesktopRegion& region) { ®ion); helper_.InvalidateRegion(region); } else { - // No previous frame is available. Invalidate the whole screen. + // No previous frame is available, or the screen is resized. Invalidate the + // whole screen. helper_.InvalidateScreen(current_frame->size()); }