Discussion:
[Gnash-commit] [bug #50623] libgnashplugin freezes when SWF calls JavaScript function with non-English string parameter
Nutchanon Wetchasit
2017-03-24 06:29:38 UTC
Permalink
URL:
<http://savannah.gnu.org/bugs/?50623>

Summary: libgnashplugin freezes when SWF calls JavaScript
function with non-English string parameter
Project: Gnash - The GNU Flash player
Submitted by: nachanon
Submitted on: Fri 24 Mar 2017 01:29:37 PM ICT
Category: plugin
Severity: 3 - Normal
Release: master
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any

_______________________________________________________

Details:

While I was inspecting a special-character issue
<https://savannah.gnu.org/patch/?9264#comment2> in Gnash's ExternalInterface
implementation, I got curious of how well Gnash handle ExternalInterface
string data outside US-ASCII code points.

So, I wrote a dummy Flash-calls-JavaScript ExternalInterface test that tries
to pass string with Thai characters as call's parameter for JavaScript to
display; attached as `flash2js-thaiarg.html` in `jsflash-thaistring.zip`.

This test gives correct output when run with Flash Player: the string is
passed to JavaScript and is correctly displayed on HTML page.

However, when using Gnash, once the HTML is loaded and the SWF file is run...

* There would be no output on the page.
* The browser seems to respond slowly.
* *XUL `plugin-container` process would constantly consume 100% of CPU.*
* Once ~10 sec is passed, a message "ERROR: Host container communication timed
out" would appear on the console.
* Things will continue like this until I tried to open a new tab in browser.
* Once the browser responds, *the browser would say that libgnashplugin
"crashed"*.
* Once the "crash" message appeared, browser's response speed (and CPU usage)
would come back to normal.

Despite what browser said, there's no core file dumped. Attaching GDB to a
busy `plugin-container` process revealed that it didn't exactly "crashed", but
rather "froze" (something like endless loop) until the browser killed it with
SIGTERM.

According to Gnash-libgnashplugin communication log, the player side seemed to
send Thai string parameter correctly (in UTF-8 encoding), but libgnashplugin
sent back nothing (which explains "Host container communication timed out"
message). So this is likely libgnashplugin's internal problem, especially how
it parsed/converted/forwarded the NPVariant value.

Gnash: 0.8.11dev (git 8a11e60 8-Mar-2017) NPAPI
Flash Player: 11.2.202.491 (NPAPI)
Browser: Iceweasel 10.0.12esr-1 (debian)
Locale: th_TH (system encoding TIS-620)
System: Debian GNU/Linux 7.0 Wheezy i386




_______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 24 Mar 2017 01:29:37 PM ICT Name: jsflash-thaistring.zip Size:
15kB By: nachanon
Test SWF and HTML files with reference screenshots, text output, and trace log
<http://savannah.gnu.org/bugs/download.php?file_id=40109>

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?50623>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Nutchanon Wetchasit
2017-03-24 06:36:33 UTC
Permalink
Follow-up Comment #1, bug #50623 (project gnash):

Gnash's screenshots, browser's text output, Gnash-libgnashplugin communication
log, debug output, and GDB backtrace log (captured at the time of GDB
attachment to busy `plugin-container` process, and at SIGTERM) are attached as
`jsflash-thaistring_gnash0.8.11dev-8a11e60.zip`.

Gnash's behavior summary:

* JavaScript calls Flash, Thai string parameter: parmeter value is passed and
printed correctly.
* JavaScript calls Flash, Thai string return value: return value is passed and
displayed correctly.
* Flash calls JavaScript, Thai string parameter: *libgnashplugin froze, and
the call never reached JavaScript*.
* Flash calls JavaScript, Thai string return value: return value is passed and
printed correctly.

Side note: there is an excess newline
<https://git.savannah.gnu.org/cgit/gnash.git/tree/libcore/ExternalInterface.cpp?id=8a11e60585db4ed6bc4eafadfbd9b3123ced45d9#n352>
at the end of "Host container communication timed out" error message, which I
will submit a separate patch to fix.

Gnash: 0.8.11dev (git 8a11e60 8-Mar-2017) NPAPI
Browser: Iceweasel 10.0.12esr-1 (debian)
Locale: th_TH (system encoding TIS-620)
System: Debian GNU/Linux 7.0 Wheezy i386


(file #40110)
_______________________________________________________

Additional Item Attachment:

File name: jsflash-thaistring_gnash0.8.11dev-8a11e60.zip Size:21 KB


_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?50623>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

Loading...