summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 02:02:43 +0000
committersuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 02:02:43 +0000
commit376cd88f3ee18b731275f51c6db2cce15c47dbd0 (patch)
tree7a0d9dc16ba5fadf59b5b333f0ff6e3ef2bcad01
parentee94d452b99306d37fa8103981562125c31056c8 (diff)
downloadchromium_src-376cd88f3ee18b731275f51c6db2cce15c47dbd0.zip
chromium_src-376cd88f3ee18b731275f51c6db2cce15c47dbd0.tar.gz
chromium_src-376cd88f3ee18b731275f51c6db2cce15c47dbd0.tar.bz2
Fix an uninitialized memory error reported by valgrind.
In order to make valgrind happy, this CL changes WebKeyboardEvent::isSystemKey and WebMouseWheelEvent::scrollByPage to int type to make sure the size of WebKeyboardEvent and WebMouseWheelEvent align to a factor of 4 bytes strictly. BUG=22857: Uninitialized memory sent via IPC from RenderWidgetHostViewGtkWidget::KeyPressReleaseEvent() TEST=Run chrome with valgrind and input something or scroll the mouse wheel in a web page, valgrind should not complain uninitialized memory anymore. Review URL: http://codereview.chromium.org/235038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27451 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/api/public/WebInputEvent.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/webkit/api/public/WebInputEvent.h b/webkit/api/public/WebInputEvent.h
index a0f17f7..43d4b13 100644
--- a/webkit/api/public/WebInputEvent.h
+++ b/webkit/api/public/WebInputEvent.h
@@ -172,7 +172,11 @@ namespace WebKit {
// http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for
// details). Other platforms don't have this concept, but it's just
// easier to leave it always false than ifdef.
- bool isSystemKey;
+ // int is used instead of bool to ensure the size of this structure is
+ // strictly aligned to a factor of 4 bytes, otherwise memory check tools
+ // like valgrind may complain about uninitialized memory usage when
+ // transfering it over the wire.
+ int isSystemKey;
WebKeyboardEvent(unsigned sizeParam = sizeof(WebKeyboardEvent))
: WebInputEvent(sizeParam)
@@ -233,7 +237,12 @@ namespace WebKit {
float deltaY;
float wheelTicksX;
float wheelTicksY;
- bool scrollByPage;
+
+ // int is used instead of bool to ensure the size of this structure is
+ // strictly aligned to a factor of 4 bytes, otherwise memory check tools
+ // like valgrind may complain about uninitialized memory usage when
+ // transfering it over the wire.
+ int scrollByPage;
WebMouseWheelEvent(unsigned sizeParam = sizeof(WebMouseWheelEvent))
: WebMouseEvent(sizeParam)