[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#443399: konqueror-nsplugins: Konqueror hangs with Flash contents



reopen 443399
tag 443399 + patch
thanks

Recalling http://www.debian.org/social_contract:

    4. Our priorities are our users and free software

We will be guided by the needs of our users and the free software community. We will place their interests first in our priorities. We will support the needs of our users for operation in many different kinds of computing environments. We will not object to non-free works that are intended to be used on Debian systems, or attempt to charge a fee to people who create or use such works.

Obviously, this bug is really Adobe's problem, and future versions of libflashplayer.so will hopefully call gtk_init. However, as a Debian user, I would rather that this bug be worked around for the _current_ version of libflashplayer.so than to hear arguments about why that's aesthetically unpleasing for some developers.

On the other hand, Adobe shouldn't be given a free pass to release new, buggy versions of their plugin.

I've attached a patch against the Debian kdebase sources that adds a small amount of code to detect "libflashplugin.so", compute its SHA256 hash, and then call gtk_init_check(0,0) only if the computed hash matches one of the hashes compiled into nspluginviewer.

This workaround-plus-hash-check resolves the immediate problem for Debian KDE users, while maintaining an incentive for Adobe to fix its bug (since every new version of libflashplayer.so that doesn't fix this bug will remain broken at least until a new konqueror-nsplugins package is released).

Alternatively, if you don't want to merge this workaround as-is, you could modify it to refuse to load the buggy plugin, which would at least prevent Konqueror from hanging when it runs into this bug.

--
Dwayne C. Litzenberger <dlitz@dlitz.net>
  Patch to work around Debian Bug#443399: "Konqueror hangs with Flash contents"

  Copyright (c) 2007 Dwayne C. Litzenberger <dlitz@dlitz.net>

  This patch is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  
  This patch is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  In addition, as a special exception, the copyright holders give
  permission to link the code of this patch with any edition of
  the Qt library by Trolltech AS, Norway (or with modified versions
  of Qt that use the same license as Qt), and distribute linked
  combinations including the two.  You must obey the GNU General
  Public License in all respects for all of the code used other than
  Qt.  If you modify this file, you may extend this exception to
  your version of the file, but you are not obligated to do so.  If
  you do not wish to do so, delete this exception statement from
  your version.

diff -ruN orig/kdebase-3.5.7.dfsg.1/debian/konqueror-nsplugins.install kdebase-3.5.7.dfsg.1/debian/konqueror-nsplugins.install
--- orig/kdebase-3.5.7.dfsg.1/debian/konqueror-nsplugins.install	2007-10-14 11:45:59.000000000 -0600
+++ kdebase-3.5.7.dfsg.1/debian/konqueror-nsplugins.install	2007-10-14 11:52:48.000000000 -0600
@@ -1,3 +1,4 @@
+debian/nspluginviewer_sha256cmp usr/bin/
 debian/tmp/usr/bin/nspluginscan
 debian/tmp/usr/bin/nspluginviewer
 debian/tmp/usr/lib/kde3/kcm_nsplugins.la
diff -ruN orig/kdebase-3.5.7.dfsg.1/debian/nspluginviewer_sha256cmp kdebase-3.5.7.dfsg.1/debian/nspluginviewer_sha256cmp
--- orig/kdebase-3.5.7.dfsg.1/debian/nspluginviewer_sha256cmp	1969-12-31 18:00:00.000000000 -0600
+++ kdebase-3.5.7.dfsg.1/debian/nspluginviewer_sha256cmp	2007-10-14 11:39:24.000000000 -0600
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Usage: sha256cmp FILE HASH...
+set -e
+hash=`sha256sum < "$1" | awk '{ print $1 }'`
+shift
+for h in "$@" ; do
+    if test "$hash" = "$h" ; then
+        exit 0
+    fi
+done
+exit 1
diff -ruN orig/kdebase-3.5.7.dfsg.1/debian/patches/62_nspluginviewer_gtk_workaround.diff kdebase-3.5.7.dfsg.1/debian/patches/62_nspluginviewer_gtk_workaround.diff
--- orig/kdebase-3.5.7.dfsg.1/debian/patches/62_nspluginviewer_gtk_workaround.diff	1969-12-31 18:00:00.000000000 -0600
+++ kdebase-3.5.7.dfsg.1/debian/patches/62_nspluginviewer_gtk_workaround.diff	2007-10-14 11:38:49.000000000 -0600
@@ -0,0 +1,40 @@
+--- ../orig/kdebase-3.5.7.dfsg.1/nsplugins/viewer/nsplugin.cpp	2006-10-01 11:31:58.000000000 -0600
++++ ./nsplugins/viewer/nsplugin.cpp	2007-10-14 11:30:32.000000000 -0600
+@@ -1381,6 +1381,37 @@ int NSPluginClass::initialize()
+    _nsFuncs.invalidaterect = g_NPN_InvalidateRect;
+    _nsFuncs.invalidateregion = g_NPN_InvalidateRegion;
+    _nsFuncs.forceredraw = g_NPN_ForceRedraw;
++    
++   // Workaround for buggy Adobe Flash player
++   if (_libname.endsWith(QString("libflashplayer.so"))) {
++       // Check hash of plugin
++       QString cmdline = "nspluginviewer_sha256cmp";
++       QString cmdarg = QString(_libname).replace("'", "'\\''");
++       cmdline += " '" + cmdarg + "'";
++       cmdline += " ccde61a3923743b6060eea7a3fd5076e1cfe135eaf8daac21a6a504b498fa506";
++       int rc = system((const char *)cmdline.utf8());
++
++       // If the plugin is matched, initialize GTK+
++       if (rc == 0) {
++           typedef int (GtkInitFunction)(int *argc, char ***argv);
++           KLibrary *libgtk;
++           const char *libgtk_name = "libgtk-x11-2.0.so.0";
++           
++           kdDebug(1431) << "Buggy Abobe Flash plugin detected.  Enabling workaround..." << endl;
++           libgtk = KLibLoader::self()->library(QFile::encodeName(QString(libgtk_name)));
++           if (!libgtk) {
++              kdDebug(1431) << "workaround: Unable to load " << libgtk_name << ".  Continuing." << endl;
++           } else {
++              GtkInitFunction *gtkInitCheck = (GtkInitFunction *) libgtk->symbol("gtk_init_check");
++              if (!gtkInitCheck(0, 0)) {
++                  kdDebug(1431) << "workaround: gtk_init_check(0,0) failed.  Continuing." << endl;
++              } else {
++                  kdDebug(1431) << "workaround: gtk_init_check(0,0) succeeded." << endl;
++              }
++              libgtk->unload();
++           }
++       }
++   }
+ 
+    // initialize plugin
+    NPError error = _NP_Initialize(&_nsFuncs, &_pluginFuncs);

Reply to: