Initialize WebKitWebPlugin path to prevent double-free; from upstream

landry@ (maintainer) is currently away, so ok jasper@
This commit is contained in:
ajacoutot 2013-05-07 14:16:52 +00:00
parent c7d3acaf51
commit 61190f187b
4 changed files with 73 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.83 2013/04/23 09:40:58 landry Exp $
# $OpenBSD: Makefile,v 1.84 2013/05/07 14:16:52 ajacoutot Exp $
ONLY_FOR_ARCHS= ${GCC4_ARCHS}
@ -7,7 +7,7 @@ COMMENT = open source web browser engine for Gtk+
V = 2.0.1
DISTNAME = webkitgtk-${V}
PKGNAME = webkit-${V}
REVISION = 0
REVISION = 1
EPOCH = 0
CATEGORIES = www
DPB_PROPERTIES =parallel

View File

@ -1,8 +1,8 @@
$OpenBSD: patch-Source_WTF_wtf_StackBounds_cpp,v 1.1 2013/04/23 09:40:58 landry Exp $
$OpenBSD: patch-Source_WTF_wtf_StackBounds_cpp,v 1.2 2013/05/07 14:16:52 ajacoutot Exp $
https://bugs.webkit.org/show_bug.cgi?id=114978
--- Source/WTF/wtf/StackBounds.cpp.orig Thu Jun 14 06:23:17 2012
+++ Source/WTF/wtf/StackBounds.cpp Mon Apr 22 11:13:12 2013
@@ -60,10 +60,10 @@
--- Source/WTF/wtf/StackBounds.cpp.orig Thu Jun 14 12:23:17 2012
+++ Source/WTF/wtf/StackBounds.cpp Tue May 7 09:48:59 2013
@@ -60,10 +60,10 @@ namespace WTF {
// These platforms should now be working correctly:
// DARWIN, QNX, UNIX
// These platforms are not:
@ -15,7 +15,7 @@ https://bugs.webkit.org/show_bug.cgi?id=114978
// Based on the current limit used by the JSC parser, guess the stack size.
static const ptrdiff_t estimatedStackSize = 128 * sizeof(void*) * 1024;
// This method assumes the stack is growing downwards.
@@ -125,7 +125,12 @@
@@ -125,7 +125,12 @@ void StackBounds::initialize()
stack_t stack;
pthread_stackseg_np(thread, &stack);
m_origin = stack.ss_sp;

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-Source_WebKit_gtk_webkit_webkitwebplugin_cpp,v 1.1 2013/05/07 14:16:52 ajacoutot Exp $
http://trac.webkit.org/changeset/149666
--- Source/WebKit/gtk/webkit/webkitwebplugin.cpp.orig Tue Oct 16 08:53:09 2012
+++ Source/WebKit/gtk/webkit/webkitwebplugin.cpp Tue May 7 09:49:23 2013
@@ -63,8 +63,6 @@ static void webkit_web_plugin_finalize(GObject* object
WebKitWebPlugin* plugin = WEBKIT_WEB_PLUGIN(object);
WebKitWebPluginPrivate* priv = plugin->priv;
- g_free(priv->path);
-
g_slist_foreach(priv->mimeTypes, (GFunc)freeMIMEType, 0);
g_slist_free(priv->mimeTypes);
@@ -191,22 +189,19 @@ const char* webkit_web_plugin_get_path(WebKitWebPlugin
WebKitWebPluginPrivate* priv = plugin->priv;
if (priv->path)
- return priv->path;
+ return priv->path.get();
- GError* error = 0;
- priv->path = g_filename_from_utf8(priv->corePlugin->path().utf8().data(), -1, 0, 0, &error);
+ GOwnPtr<GError> error;
+ priv->path.set(g_filename_from_utf8(priv->corePlugin->path().utf8().data(), -1, 0, 0, &error.outPtr()));
if (!error)
- return priv->path;
+ return priv->path.get();
// In the unlikely case the convertion fails, report the error and make sure we free
// any partial convertion that ended up in the variable.
- g_free(priv->path);
- priv->path = 0;
+ priv->path.clear();
g_warning("Failed to convert '%s' to system filename encoding: %s", priv->corePlugin->path().utf8().data(), error->message);
-
- g_clear_error(&error);
return 0;
}

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-Source_WebKit_gtk_webkit_webkitwebpluginprivate_h,v 1.1 2013/05/07 14:16:52 ajacoutot Exp $
http://trac.webkit.org/changeset/149666
--- Source/WebKit/gtk/webkit/webkitwebpluginprivate.h.orig Thu Oct 27 22:51:16 2011
+++ Source/WebKit/gtk/webkit/webkitwebpluginprivate.h Tue May 7 09:49:21 2013
@@ -21,6 +21,7 @@
#include "webkitwebplugin.h"
#include <glib-object.h>
+#include <wtf/gobject/GOwnPtr.h>
#include <wtf/text/CString.h>
namespace WebCore {
@@ -38,7 +39,7 @@ struct _WebKitWebPluginPrivate {
RefPtr<WebCore::PluginPackage> corePlugin;
CString name;
CString description;
- char* path;
+ GOwnPtr<char> path;
GSList* mimeTypes;
};