Hi stable release managers,

would you accept a update of gnash via s-p-u with the attached patch for 
497633, severity important, causing ~/.Xsession of a user under certain 
frequent circumstances to grow several hundred megabytes in a few days as one 
can be read in the bug. (This has also caused data lost in the past as you 
can read there too.)

The attached patch (also available via 
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=37;filename=gnash.diff;att=1;bug=497633
 ) 
is already in sid and testing and has maintainer approval as you can read 
below.

Should I reassign or clone 497633 to release.debian.org?

On Freitag, 18. Dezember 2009, Miriam Ruiz wrote:
> 2009/12/18 Robert Millan <r...@aybabtu.com>:
> > On Fri, Dec 18, 2009 at 01:05:29PM +0100, Petter Reinholdtsen wrote:
> >> Hi.  We are working on wrapping up the Lenny version of Debian Edu,
> >> and ran into a fatal problem with Gnash.  On the commonly used web
> >> sites, gnash will fill up ~/.xsession-errors with messages and thus
> >> fill the users home directories very quickly.  The issue is reported
> >> to us in <URL: http://bugs.skolelinux.org/1404 >, and to Debian as
> >> <URL: http://bugs.debian.org/497633 >.
> >>
> >> I've created a patch that solve this issue, and submitted it to the
> >> BTS.  Would you be willing to apply this patch to a stable update of
> >> gnash in Lenny, to make it possible for us to continue using Gnash
> >> from Lenny in the default Debian Edu installation?
> >
> > I have no objection.  Miriam, are you ok with it?
>
> +1
>
> I had a look at the patch yesterday and I have no problem at all with
> it. In any case, I won't be able to take care of anything until at
> least the beginning of next week, so if anyone is willing to apply the
> patch ASAP, they got my green light for that. In other case, I'll try
> to get some time for that as soon as I can.
>
> >> The issue is fixed in version 0.8.5 of gnash, but a backport of gnash
> >> 0.8.6 in Sid is first of all hard because of a lot of new
> >> dependencies,


regards,
        Holger
--- gnash-0.8.4.orig/plugin/plugin.cpp
+++ gnash-0.8.4/plugin/plugin.cpp
@@ -47,6 +47,15 @@
   http://www.gnu.org/software/gnash</a>. \
   Compatible Shockwave Flash "FLASH_VERSION
 
+// Define the following to make the plugin verbose
+// WARNING: will write to .xsession_errors !
+// Values:
+//  1: fatal errors (errors preventing the plugin from working as it should)
+//  2: informational messages
+//
+#define GNASH_PLUGIN_DEBUG 1
+
+
 #include <sys/param.h>
 #include "plugin.h" //Fixes Warning on redef of MIN/MAX
 #include <csignal>
@@ -139,11 +148,15 @@
 {
        if ( plugInitialized )
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "NS_PluginInitialize called, but ignored (we already 
initialized)" << endl;
+#endif
                return NPERR_NO_ERROR;
        }
 
+#if GNASH_PLUGIN_DEBUG > 1
        cout << "NS_PluginInitialize call 
---------------------------------------------------" << endl;
+#endif
 
 #ifdef HAVE_XPCOM
        if(!cookieManager) {
@@ -155,7 +168,9 @@
                                                        (reinterpret_cast<void 
**>(&serviceManager)));
 
                if (err != NPERR_NO_ERROR || !serviceManager) {
+#if GNASH_PLUGIN_DEBUG > 1
                        cout << "Failed to get the service manager" << endl;
+#endif
                        return NPERR_GENERIC_ERROR;
                }
                nsresult rv;
@@ -163,10 +178,14 @@
                                                                NS_GET_IID 
(nsICookieManager),
                                                                
reinterpret_cast<void **>(&cookieManager));
                if (NS_FAILED (rv) || !cookieManager) {
+#if GNASH_PLUGIN_DEBUG > 1
                        cout << "Failed to get CookieManager" << endl;
+#endif
                        return NPERR_GENERIC_ERROR;
                }
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "[XPCOM] - CookieManager retrieved." << endl;
+#endif
        }
 #endif // HAVE_XPCOM
 
@@ -189,13 +208,17 @@
 
        if (err != NPERR_NO_ERROR || !supportsXEmbed)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "NPAPI ERROR: No xEmbed support in this browser!"
                                                        << endl;
+#endif
                return NPERR_INCOMPATIBLE_VERSION_ERROR;
        }
        else
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "xEmbed supported in this browser" << endl;
+#endif
        }
 
        err = CallNPN_GetValueProc(NPNFuncs.getvalue, NULL,
@@ -208,14 +231,18 @@
        */
        if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "NPAPI ERROR: No GTK2 support in this browser!"
                        " Have version " << (int)toolkit << endl;
+#endif
 
                return NPERR_INCOMPATIBLE_VERSION_ERROR;
        }
        else
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "GTK2 supported in this browser" << endl;
+#endif
        }
 
        /*
@@ -224,7 +251,9 @@
        char* opts = std::getenv("GNASH_OPTIONS");
        if (opts != NULL)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "GNASH_OPTIONS : " << opts << endl;
+#endif
                
                // Should the plugin wait for gdb to be attached?
                if ( strstr(opts, "waitforgdb") )
@@ -266,7 +295,9 @@
                {
                        cerr << "WARNING: NPAPI plugin could not append to the 
GNASHRC env variable" << endl;
                }
+#if GNASH_PLUGIN_DEBUG > 1
                else cout << "NOTE: NPAPI plugin set GNASHRC to " << newGnashRc 
<< endl;
+#endif
 
        } while (0);
 
@@ -290,7 +321,9 @@
 #if 0
        if (!plugInitialized)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Plugin already shut down" << endl;
+#endif
                return;
        }
 
@@ -404,7 +437,9 @@
                        _name = val;
                }
 
+#if GNASH_PLUGIN_DEBUG > 1
                cerr << "PARAM: " << name << " = " << val << endl;
+#endif
                _params[name] = val;
        }
 
@@ -413,10 +448,14 @@
 /// \brief Destructor
 nsPluginInstance::~nsPluginInstance()
 {
+#if GNASH_PLUGIN_DEBUG > 1
        cout << "plugin instance destruction" << endl;
+#endif
        if ( _ichan )
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "shutting down input chan " << _ichan << endl;
+#endif
                GError *error = NULL;
                g_io_channel_shutdown (_ichan, TRUE, &error);
                g_io_channel_unref (_ichan);
@@ -428,7 +467,9 @@
 
     // TODO: unlink the cookie jar
     if ( ! _cookieFile.empty() ) {
+#if GNASH_PLUGIN_DEBUG > 1
            cout << " ~nsPluginInstance: file " << _cookieFile << " should be 
unlinked!" << endl;
+#endif
     }
 }
 
@@ -442,17 +483,21 @@
 {
        if(!aWindow)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout <<  __PRETTY_FUNCTION__ << " ERROR: Window handle was 
bogus!" << endl;
+#endif
                return FALSE;
        }
        else
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "X origin: = " << aWindow->x 
                        << ", Y Origin = " << aWindow->y
                        << ", Width = " << aWindow->width
                        << ", Height = " << aWindow->height
                        << ", WindowID = " << aWindow->window
                        << ", this = " << static_cast<void*>(this) << endl;
+#endif
        }
 
 #if 0
@@ -461,7 +506,9 @@
 
     bool gdb = true;
     while (gdb) {
+#if GNASH_PLUGIN_DEBUG > 1
        cout << "Waiting for GDB for pid " << getpid() << endl;
+#endif
        sleep(5);
     }
 #endif
@@ -477,7 +524,9 @@
 void
 nsPluginInstance::shut()
 {
+#if GNASH_PLUGIN_DEBUG > 1
        cout << "Shutting down" << endl;
+#endif
 
        if (_childpid > 0)
        {
@@ -487,7 +536,9 @@
                kill(_childpid, SIGTERM);
                int status;
                waitpid(_childpid, &status, 0);
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Child process exited with status " << status << endl;  
+#endif
        }
 
        _childpid = 0;
@@ -505,7 +556,9 @@
 {
        if(!aWindow)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << __FUNCTION__ << ": ERROR: Window handle was bogus!" << 
endl;
+#endif
                return NPERR_INVALID_PARAM;
 #if 0
        }
@@ -542,7 +595,9 @@
 nsPluginInstance::WriteStatus(char *msg) const
 {
        NPN_Status(_instance, msg);
+#if GNASH_PLUGIN_DEBUG > 1
        cout << msg << endl;
+#endif
 
        return NPERR_NO_ERROR;
 }
@@ -569,7 +624,9 @@
 {
        _swf_url = stream->url;
 
+#if GNASH_PLUGIN_DEBUG > 1
        cout << __FUNCTION__ << ": The full URL is " << _swf_url << endl;
+#endif
 
 #ifdef WRITE_FILE
        size_t start, end;
@@ -578,7 +635,9 @@
        start = _swf_url.rfind("/", end) + 1;
        fname = "/tmp/";
        fname += _swf_url.substr(start, end - start);
+#if GNASH_PLUGIN_DEBUG > 1
        cout << "The Flash movie name is: " << fname << endl;
+#endif
 
        _filefd = open(fname.c_str(), O_CREAT | O_WRONLY, 
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
     
@@ -674,7 +733,9 @@
 {
        if ( cond & G_IO_HUP )
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Player request channel hang up" << endl;
+#endif
                g_source_remove(_ichanWatchId);
                return false;
        }
@@ -682,7 +743,9 @@
        assert(cond & G_IO_IN);
        int inputfd = g_io_channel_unix_get_fd(iochan);
 
+#if GNASH_PLUGIN_DEBUG > 1
        cout << "Checking player requests on fd " << inputfd << endl;
+#endif
 
        do
        {
@@ -693,21 +756,31 @@
                switch ( status )
                {
                        case G_IO_STATUS_ERROR:
+#if GNASH_PLUGIN_DEBUG > 1
                                cout << "Error reading request line: " << 
error->message << endl; 
+#endif
                                g_error_free(error);
                                return false;
                        case G_IO_STATUS_EOF:
+#if GNASH_PLUGIN_DEBUG > 1
                                cout << "EOF (error:" << error << ")" << endl;
+#endif
                                return false;
                        case G_IO_STATUS_AGAIN:
+#if GNASH_PLUGIN_DEBUG > 1
                                cout << "Read again (error:" << error << ")" << 
endl;
+#endif
                                break;
                        case G_IO_STATUS_NORMAL:
                                // process request
+#if GNASH_PLUGIN_DEBUG > 1
                                cout << "Normal read: " << request << " 
(error:" << error << ")" << endl;
+#endif
                                break;
                        default:
+#if GNASH_PLUGIN_DEBUG > 1
                                cout << "Abnormal status " << status << "  
(error:" << error << ")" << endl;
+#endif
                                return false;
                        
                }
@@ -727,7 +800,9 @@
 {
        if ( linelen < 4 )
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Invalid player request (too short): " << buf << endl;
+#endif
                return false;
        }
 
@@ -736,7 +811,9 @@
                char* target = buf+4;
                if ( ! *target )
                {
+#if GNASH_PLUGIN_DEBUG > 1
                        cout << "No target found after GET request" << endl;
+#endif
                        return false;
                }
                char* url = target;
@@ -748,11 +825,15 @@
                }
                else
                {
+#if GNASH_PLUGIN_DEBUG > 1
                        cout << "No colon found after GETURL target string" << 
endl;
+#endif
                        return false;
                }
 
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Asked to get URL '" << url << "' in target '" << 
target << "'" << endl;
+#endif
                NPN_GetURL(_instance, url, target);
                return true;
 
@@ -761,7 +842,9 @@
        {
                char* command = buf+7;
                if ( ! *command ) {
+#if GNASH_PLUGIN_DEBUG > 1
                        cout << "No command found after INVOKE request" << endl;
+#endif
                        return false;
                }
                char* arg = command;
@@ -770,7 +853,9 @@
                        *arg='\0';
                        ++arg;
                } else {
+#if GNASH_PLUGIN_DEBUG > 1
                        cout << "No colon found after INVOKE command string" << 
endl;
+#endif
                        return false;
                }
 
@@ -782,13 +867,17 @@
                // TODO: check if _self is a good target for this
                static const char* tgt = "_self";
 
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Calling NPN_GetURL(" << jsurl.str() << ", '" << tgt << 
"');" << endl;
+#endif
                NPN_GetURL(_instance, jsurl.str().c_str(), tgt);
                return true;
        }
        else
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Unknown player request: '" << buf << "'" << endl;
+#endif
                return false;
        }
 }
@@ -804,7 +893,9 @@
        nsISupports * sm = NULL;
 
        // Get service manager
+#if GNASH_PLUGIN_DEBUG > 1
        cerr << "Getting Path" << NPN_GetValue(NULL, NPNVserviceManager, &sm) 
<< "\n";
+#endif
 
        // Mozilla returns nsIServiceManager so we can use it directly;
        // doing QI on nsISupports here can still be more appropriate in
@@ -823,17 +914,23 @@
 
        // Gets extension service
        rv = 
gServiceManager->GetServiceByContractID("@mozilla.org/extensions/manager;1", 
NS_GET_IID(nsIExtensionManager), (void **)&nsExtensionService);
+#if GNASH_PLUGIN_DEBUG > 1
        cerr << "gSM" << rv << " " << (nsExtensionService == NULL) << "\n";
+#endif
        if (!nsExtensionService) return -2;
        
        // Gets install location object
        rv = 
nsExtensionService->GetInstallLocation(NS_LITERAL_STRING("{2b70f2b1-fc72-4734-bb81-4eb2a7713e49}"),
 (nsIInstallLocation**)&installLocation);
+#if GNASH_PLUGIN_DEBUG > 1
        cerr << "nES" << rv << " " << (installLocation == NULL) << "\n";
+#endif
        if (!installLocation) return -3;
 
        // Gets information on file in the extension - here, 
"petsc...@petscity.com" is the ID of the plugin. install.rdf is a file stored 
in the plugin
        rv = 
installLocation->GetItemFile(NS_LITERAL_STRING("{2b70f2b1-fc72-4734-bb81-4eb2a7713e49}"),
 NS_LITERAL_STRING("plugins/gnash"), (nsIFile**)&file);
+#if GNASH_PLUGIN_DEBUG > 1
        cerr << "iL" << rv << " " << (file == NULL) << "\n";
+#endif
        if (!file) return -4;
 
        // We get the path (stored as unicode in nsName)
@@ -842,7 +939,9 @@
 
                //const NPString& propValue = 
NS_LossyConvertUTF16toASCII(sName);
        gnashpath = ToNewCString(NS_LossyConvertUTF16toASCII(sName));
+#if GNASH_PLUGIN_DEBUG > 1
        cerr << "Path" << gnashpath << "\n";
+#endif
        return 0;
 }
 #endif // GNASH_XPI_PLUGIN
@@ -851,14 +950,18 @@
 nsPluginInstance::dumpCookies()
 {
     if ( ! _cookieFile.empty() ) {
+#if GNASH_PLUGIN_DEBUG > 1
            cout << " dumpCookies: file " << _cookieFile << " should be 
unlinked!" << endl;
+#endif
     }
     _cookieFile.clear();
 
 // Linking problems...
 //#ifdef HAVE_XPCOM 
 #if 0
+#if GNASH_PLUGIN_DEBUG > 1
        cout << "[XPCOM] trying to dump cookies" << endl;
+#endif
 
        nsCOMPtr<nsISimpleEnumerator> cookie_e;
        nsresult rv =  cookieManager->GetEnumerator(getter_AddRefs(cookie_e));
@@ -874,10 +977,14 @@
                        const char *tmpname = tmpnam(tmpnamebuf); 
                        fout.open(tmpname, ios::out | ios::trunc);
                        if(!fout.is_open()) {
+#if GNASH_PLUGIN_DEBUG > 1
                                cout << "not opened!!" << endl;
+#endif
                                continue;
                        } else {
+#if GNASH_PLUGIN_DEBUG > 1
                                cout << "opened cookie store: " << tmpname << 
endl;
+#endif
                        }
                        res = TRUE;
                        _cookieFile = tmpname; // assign ? 
@@ -894,32 +1001,44 @@
 
                        nsCString host;
                        if(NS_FAILED(cookie->GetHost(host))) {
+#if GNASH_PLUGIN_DEBUG > 1
                          cout << "[XPCOM] cookie without host ... ommitting" 
<< endl;
+#endif
                          continue;
                        }
                        nsCString path;
                        if(NS_FAILED(cookie->GetPath(path))) {
+#if GNASH_PLUGIN_DEBUG > 1
                          cout << "[XPCOM] cookie without path ... ommitting" 
<< endl;
+#endif
                          continue;
                        }
                        PRBool isSecure;
                        if(NS_FAILED(cookie->GetIsSecure(&isSecure))) {
+#if GNASH_PLUGIN_DEBUG > 1
                          cout << "[XPCOM] cookie without isSecure ... 
ommitting" << endl;
+#endif
                          continue;
                        }
                        PRUint64 expires;
                        if(NS_FAILED(cookie->GetExpires(&expires))) {
+#if GNASH_PLUGIN_DEBUG > 1
                          cout << "[XPCOM] cookie without expires ... 
ommitting" << endl;
+#endif
                          continue;
                        }       
                        nsCString name;
                        if(NS_FAILED(cookie->GetName(name))) {
+#if GNASH_PLUGIN_DEBUG > 1
                          cout << "[XPCOM] cookie without name ... ommitting" 
<< endl;
+#endif
                          continue;
                        }
                        nsCString value;
                        if(NS_FAILED(cookie->GetValue(value))) {
+#if GNASH_PLUGIN_DEBUG > 1
                          cout << "[XPCOM] cookie without value ... ommitting" 
<< endl;
+#endif
                          continue;
                        }
 
@@ -953,9 +1072,13 @@
                        c++;
                }
                fout.close();
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "[XPCOM] dump finished (" << c << " cookies in total)" 
<< endl;
+#endif
        } else {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "[XPCOM] WARNING: Cookie feature disabled" << endl;
+#endif
        }
 #endif // HAVE_XPCOM
 
@@ -983,7 +1106,9 @@
        const char* pageurl = getCurrentPageURL();
        if (!pageurl)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Could not get current page URL!" << endl;
+#endif
        }
 
        struct stat procstats;
@@ -991,7 +1116,9 @@
        // See if the file actually exists, otherwise we can't spawn it
        if (stat(procname.c_str(), &procstats) == -1)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Invalid path to standalone executable: " << procname 
<< endl;
+#endif
                return;
        }
 
@@ -1004,14 +1131,18 @@
        int ret = pipe(p2c_pipe);
        if (ret == -1)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "ERROR: parent to child pipe() failed: " << 
strerror(errno) << endl;
+#endif
        }
        _streamfd = p2c_pipe[1];
 
        ret = pipe(c2p_pipe);
        if (ret == -1)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "ERROR: child to parent pipe() failed: " << 
strerror(errno) << endl;
+#endif
        }
 
 
@@ -1112,7 +1243,9 @@
        // If the fork failed, childpid is -1. So print out an error message.
        if (_childpid == -1)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "ERROR: dup2() failed: " << strerror(errno) << endl;
+#endif
                return;
        }
 
@@ -1125,22 +1258,28 @@
                ret = close (p2c_pipe[0]);
                if (ret == -1)
                {
+#if GNASH_PLUGIN_DEBUG > 1
                        cout << "ERROR: p2c_pipe[0] close() failed: " << 
strerror(errno)
                                                                << endl;
+#endif
                }
 
                // we want to read from c2p pipe, so close read-fd1
                ret = close (c2p_pipe[1]);
                if (ret == -1)
                {
+#if GNASH_PLUGIN_DEBUG > 1
                        cout << "ERROR: c2p_pipe[1] close() failed: " << 
strerror(errno)
                                                                << endl;
+#endif
                }
        
 
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Forked successfully, child process PID is " 
                                                                << _childpid
                                                                << endl;
+#endif
 
                _ichan = g_io_channel_unix_new(c2p_pipe[0]);
                g_io_channel_set_close_on_unref(_ichan, true);
@@ -1158,7 +1297,9 @@
        ret = close (p2c_pipe[1]); 
        if (ret == -1)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "ERROR: close() failed: " << strerror(errno) << endl;
+#endif
        }
 
        // close standard input and direct read-fd1 to standard input
@@ -1166,7 +1307,9 @@
        
        if (ret == -1)
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "ERROR: dup2() failed: " << strerror(errno) << endl;
+#endif
        }
 
        // Close all of the browser's file descriptors that we just 
@@ -1191,7 +1334,9 @@
                }
        }
 
+#if GNASH_PLUGIN_DEBUG > 1
        cout << "Closed " << closed << " files." << endl;
+#endif
 
 
        /*
@@ -1199,6 +1344,7 @@
        */
 
        
+#if GNASH_PLUGIN_DEBUG > 1
        cout << "Starting process: ";
 
        for (int i = 0; argv[i] != 0; ++i)
@@ -1206,6 +1352,7 @@
                cout << argv[i] << " ";
        }
        cout << endl;
+#endif
 
        /*
        For debugging the plugin (GNASH_OPTIONS=waitforgdb)
@@ -1257,7 +1404,9 @@
 
        if (!NPVARIANT_IS_OBJECT(vDoc))
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Can't get window object" << endl;
+#endif
                return NULL;
        }
        
@@ -1269,7 +1418,9 @@
         NPN_ReleaseObject(npDoc);
         if (!NPVARIANT_IS_OBJECT(vLoc))
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout <<"Can't get window.location object" << endl;
+#endif
                return NULL;
        }
         NPObject* npLoc = NPVARIANT_TO_OBJECT(vLoc);
@@ -1280,7 +1431,9 @@
         NPN_ReleaseObject(npLoc);
         if (!NPVARIANT_IS_STRING(vProp))
        {
+#if GNASH_PLUGIN_DEBUG > 1
                cout << "Can't get window.location.href object" << endl;
+#endif
                return NULL;
        }
         const NPString& propValue = NPVARIANT_TO_STRING(vProp);

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to