RESOLVED INVALID 31058
[Qt] QWebSettings using unitialized values
https://bugs.webkit.org/show_bug.cgi?id=31058
Summary [Qt] QWebSettings using unitialized values
daniel.teske
Reported 2009-11-03 06:52:59 PST
The QWebSettings(WebCore::Settings* settings) ctor does access unitialized values. The current code: QWebSettings::QWebSettings(WebCore::Settings* settings) : d(new QWebSettingsPrivate(settings)) { d->settings = settings; d->apply(); allSettings()->append(d); } does not correctly initialize d->printingMinimumShrinkFactor d->printingMaximumShrinkFactor and d->offlineStorageDefaultQuota, since the QWebSettingsPrivate ctor also does not set those values. But the inside QWebSettignsPrivate::apply() d->printingMinimumShrinkFactor and d->printingMaximumShrinkFactor are accessed. This generates the following valgrind warnings: 40: ==10098== Conditional jump or move depends on uninitialised value(s) 41: ==10098== at 0x9D04BB9: QWebSettingsPrivate::apply() (in /home/apoenitz/dev/qt-4.6/lib/libQtWebKitMyns.so.4.6.0) 42: ==10098== by 0x9D0591A: QWebSettings::QWebSettings(WebCore::Settings*) (in /home/apoenitz/dev/qt-4.6/lib/libQtWebKitMyns.so.4.6.0) 43: ==10098== by 0x9CF16AF: QWebPagePrivate::QWebPagePrivate(QWebPage*) (in /home/apoenitz/dev/qt-4.6/lib/libQtWebKitMyns.so.4.6.0) 44: ==10098== by 0x9CF19FE: QWebPage::QWebPage(myns::QObject*) (in /home/apoenitz/dev/qt-4.6/lib/libQtWebKitMyns.so.4.6.0) 45: ==10098== by 0x93E6B65: HelpPage::HelpPage(Help::Internal::CentralWidget*, myns::QHelpEngine*, myns::QObject*) (helpviewer.cpp:171) 46: ==10098== by 0x93E6D0D: HelpViewer::HelpViewer(myns::QHelpEngine*, Help::Internal::CentralWidget*) (helpviewer.cpp:240) 47: ==10098== by 0x93C03E4: Help::Internal::HelpPlugin::createRightPaneSideBar() (helpplugin.cpp:494) 48: ==10098== by 0x93C60E1: Help::Internal::HelpPlugin::initialize(myns::QStringList const&, myns::QString*) (helpplugin.cpp:408) 49: ==10098== by 0x40469F6: ExtensionSystem::Internal::PluginSpecPrivate::initializePlugin() (pluginspec.cpp:827) 50: ==10098== by 0x403EF99: ExtensionSystem::Internal::PluginManagerPrivate::loadPlugin(ExtensionSystem::PluginSpec*, ExtensionSystem::PluginSpec::State) (pluginmanager.cpp:677) 51: ==10098== by 0x403FE8E: ExtensionSystem::Internal::PluginManagerPrivate::loadPlugins() (pluginmanager.cpp:582) 52: ==10098== by 0x404000F: ExtensionSystem::PluginManager::loadPlugins() (pluginmanager.cpp:246) 53: ==10098== Uninitialised value was created by a heap allocation 54: ==10098== at 0x40269EE: operator new(unsigned int) (vg_replace_malloc.c:224) 55: ==10098== by 0x9D058E5: QWebSettings::QWebSettings(WebCore::Settings*) (in /home/apoenitz/dev/qt-4.6/lib/libQtWebKitMyns.so.4.6.0) 56: ==10098== by 0x9CF16AF: QWebPagePrivate::QWebPagePrivate(QWebPage*) (in /home/apoenitz/dev/qt-4.6/lib/libQtWebKitMyns.so.4.6.0) 57: ==10098== by 0x9CF19FE: QWebPage::QWebPage(myns::QObject*) (in /home/apoenitz/dev/qt-4.6/lib/libQtWebKitMyns.so.4.6.0) 58: ==10098== by 0x93E6B65: HelpPage::HelpPage(Help::Internal::CentralWidget*, myns::QHelpEngine*, myns::QObject*) (helpviewer.cpp:171) 59: ==10098== by 0x93E6D0D: HelpViewer::HelpViewer(myns::QHelpEngine*, Help::Internal::CentralWidget*) (helpviewer.cpp:240) 60: ==10098== by 0x93C03E4: Help::Internal::HelpPlugin::createRightPaneSideBar() (helpplugin.cpp:494) 61: ==10098== by 0x93C60E1: Help::Internal::HelpPlugin::initialize(myns::QStringList const&, myns::QString*) (helpplugin.cpp:408) 62: ==10098== by 0x40469F6: ExtensionSystem::Internal::PluginSpecPrivate::initializePlugin() (pluginspec.cpp:827) 63: ==10098== by 0x403EF99: ExtensionSystem::Internal::PluginManagerPrivate::loadPlugin(ExtensionSystem::PluginSpec*, ExtensionSystem::PluginSpec::State) (pluginmanager.cpp:677) 64: ==10098== by 0x403FE8E: ExtensionSystem::Internal::PluginManagerPrivate::loadPlugins() (pluginmanager.cpp:582) 65: ==10098== by 0x404000F: ExtensionSystem::PluginManager::loadPlugins() (pluginmanager.cpp:246)
Attachments
Providing Initialization of variables in constructor (1.03 KB, patch)
2009-11-09 10:04 PST, Manish Gupta
eric: review-
initialization of variables in constructor, webkit compliant code style (1.03 KB, patch)
2009-11-10 08:30 PST, Manish Gupta
kenneth: review-
Manish Gupta
Comment 1 2009-11-09 10:04:39 PST
Created attachment 42763 [details] Providing Initialization of variables in constructor
Eric Seidel (no email)
Comment 2 2009-11-09 17:50:03 PST
Comment on attachment 42763 [details] Providing Initialization of variables in constructor This does not comply with teh webkit style guide. http://webkit.org/coding/coding-style.html Please run check-webkit-style against the file or the patch.
Manish Gupta
Comment 3 2009-11-10 08:30:29 PST
Created attachment 42868 [details] initialization of variables in constructor, webkit compliant code style
Simon Hausmann
Comment 4 2009-11-11 13:08:07 PST
Comment on attachment 42868 [details] initialization of variables in constructor, webkit compliant code style Good catch!
Jocelyn Turcotte
Comment 5 2009-11-12 06:09:39 PST
This is a duplicate of bug #30755. Both bugs have proposed patches so I'm not in position of knowing which one should be closed as duplicate. Also note that both submitted patches depends on changes of bug #29042 which have been reverted to be postponed to 4.7. Please consider it before committing.
Kenneth Rohde Christiansen
Comment 6 2009-11-12 06:37:16 PST
Comment on attachment 42868 [details] initialization of variables in constructor, webkit compliant code style The code was been reverted, so marking r-. I also noticed these issues yesterday due to crashes in the DRT, but didn't review this patch as Benjamin and me decided to revert the patch introducing the change instead,
Simon Hausmann
Comment 7 2009-11-16 05:55:31 PST
Closing this bug as rolling out the original patch also fixed this UMR.
Note You need to log in before you can comment on or make changes to this bug.