Bug 1409258 Adjust the definition of NPEvent and resolve uint -> int narrowing in dom/plugins r?jimm
lParam is a long int (signed) while wparam is unsigned. Correct lParam to be an intptr
MozReview-Commit-ID: BeWJUM798O5
--- a/dom/plugins/base/npapi.h
+++ b/dom/plugins/base/npapi.h
@@ -559,17 +559,17 @@ typedef EventRecord NPEvent;
#endif
#elif defined(XP_SYMBIAN)
typedef QEvent NPEvent;
#elif defined(XP_WIN)
typedef struct _NPEvent
{
uint16_t event;
uintptr_t wParam;
- uintptr_t lParam;
+ intptr_t lParam;
} NPEvent;
#elif defined(XP_UNIX) && defined(MOZ_X11)
typedef XEvent NPEvent;
#else
typedef void* NPEvent;
#endif
#if defined(XP_MACOSX)
old mode 100644
new mode 100755
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -3304,20 +3304,24 @@ PluginInstanceChild::UpdateWindowAttribu
#endif // XP_MACOSX
#ifdef XP_WIN
// Windowless plugins on Windows need a WM_WINDOWPOSCHANGED event to update
// their location... or at least Flash does: Silverlight uses the
// window.x/y passed to NPP_SetWindow
if (mPluginIface->event) {
+ // width and height are stored as units, but narrow to ints here
+ MOZ_RELEASE_ASSERT(mWindow.width <= INT_MAX);
+ MOZ_RELEASE_ASSERT(mWindow.height <= INT_MAX);
+
WINDOWPOS winpos = {
0, 0,
mWindow.x, mWindow.y,
- mWindow.width, mWindow.height,
+ (int32_t)mWindow.width, (int32_t)mWindow.height,
0
};
NPEvent pluginEvent = {
WM_WINDOWPOSCHANGED, 0,
(LPARAM) &winpos
};
mPluginIface->event(&mData, &pluginEvent);
}
@@ -3374,17 +3378,17 @@ PluginInstanceChild::PaintRectToPlatform
mWindow.x + aRect.x,
mWindow.y + aRect.y,
mWindow.x + aRect.XMost(),
mWindow.y + aRect.YMost()
};
NPEvent paintEvent = {
WM_PAINT,
uintptr_t(mWindow.window),
- uintptr_t(&rect)
+ intptr_t(&rect)
};
::SetViewportOrgEx((HDC) mWindow.window, -mWindow.x, -mWindow.y, nullptr);
::SelectClipRgn((HDC) mWindow.window, nullptr);
::IntersectClipRect((HDC) mWindow.window, rect.left, rect.top, rect.right, rect.bottom);
mPluginIface->event(&mData, reinterpret_cast<void*>(&paintEvent));
#else
MOZ_CRASH("Surface type not implemented.");