Commit 8f3f93de authored by xzhang's avatar xzhang Committed by Commit bot

Cast pointer to uintptr_t instead of ULONG

NPEvent::lParam is defined as uintptr_t which has same width with ULONG on Win32, but they are of different sizes on WIN64. uintptr_t is 8-byte long, while ULONG is still 4-byte long, so it corrupts a 64-bit pointer if casting it to a 32-bit type.

BUG=413535
TEST=square.html (attached in the bug), http://pbskids.org/video (it uses wmode="opaque")
R=ananta@chromium.org, bauerb@chromium.org

Review URL: https://codereview.chromium.org/571583002

Cr-Commit-Position: refs/heads/master@{#294917}
parent 1a1fd180
......@@ -449,6 +449,7 @@ Vivek Galatage <vivek.vg@samsung.com>
Will Hirsch <chromium@willhirsch.co.uk>
Xiang Long <xiang.long@intel.com>
Xinchao He <hexinchao@gmail.com>
Xing Zhang <xzhang@adobe.com>
Xu Samuel <samuel.xu@intel.com>
Xuefei Ren <xrenishere@gmail.com>
Yael Aharon <yael.aharon@intel.com>
......
......@@ -1029,7 +1029,7 @@ void WebPluginDelegateImpl::WindowlessUpdateGeometry(
NPEvent pos_changed_event;
pos_changed_event.event = WM_WINDOWPOSCHANGED;
pos_changed_event.wParam = 0;
pos_changed_event.lParam = PtrToUlong(&win_pos);
pos_changed_event.lParam = reinterpret_cast<uintptr_t>(&win_pos);
instance()->NPP_HandleEvent(&pos_changed_event);
}
......@@ -1051,9 +1051,8 @@ void WebPluginDelegateImpl::WindowlessPaint(HDC hdc,
NPEvent paint_event;
paint_event.event = WM_PAINT;
// NOTE: NPAPI is not 64bit safe. It puts pointers into 32bit values.
paint_event.wParam = PtrToUlong(hdc);
paint_event.lParam = PtrToUlong(&damage_rect_win);
paint_event.lParam = reinterpret_cast<uintptr_t>(&damage_rect_win);
base::StatsRate plugin_paint("Plugin.Paint");
base::StatsScope<base::StatsRate> scope(plugin_paint);
instance()->NPP_HandleEvent(&paint_event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment