gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [bug #47280] Gnash's ExternalInterface does not return Nu


From: Nutchanon Wetchasit
Subject: [Gnash-commit] [bug #47280] Gnash's ExternalInterface does not return Number value correctly
Date: Tue, 01 Mar 2016 14:20:51 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:25.8) Gecko/20151123 Firefox/31.9 PaleMoon/25.8.1

Follow-up Comment #3, bug #47280 (project gnash):

The problem on JavaScript-calls-Flash return value boils down to how
libgnashplugin parses `<number>` data from player side
<http://git.savannah.gnu.org/cgit/gnash.git/tree/plugin/npapi/external.cpp?id=c12c3cf104a095cff9791cdb3cee8bbf4853d5e0#n292>:

        } else if (tag == "<number>") {
            start = end;
            end = xml.find("</number>");
            std::string str = xml.substr(start, end-start);
            if (str.find(".") != std::string::npos) {
                double num = strtod(str.c_str(), nullptr);
                DOUBLE_TO_NPVARIANT(num, value);
            } else {
                int num = strtol(str.c_str(), nullptr, 0);
                INT32_TO_NPVARIANT(num, value);
            }


There are few problem with this:
* It fails when `Infinity`, `-Infinity`, or `NaN` is encountered, as the
plugin would parse it as an integer (and results in zero value).
* It fails when the number is a whole number but is not in `int32_t` range,
e.g. 4294967295.

As I understand, plugin's `ExternalInterface::parseXML()` is used only for
parsing player's answer from JavaScript call (both ExternalInterface
<http://git.savannah.gnu.org/cgit/gnash.git/tree/plugin/npapi/callbacks.cpp?id=c12c3cf104a095cff9791cdb3cee8bbf4853d5e0#n702>
and
built-in
<http://git.savannah.gnu.org/cgit/gnash.git/tree/plugin/npapi/callbacks.cpp?id=c12c3cf104a095cff9791cdb3cee8bbf4853d5e0#n233>
plugin
<http://git.savannah.gnu.org/cgit/gnash.git/tree/plugin/npapi/callbacks.cpp?id=c12c3cf104a095cff9791cdb3cee8bbf4853d5e0#n377>
functions
<http://git.savannah.gnu.org/cgit/gnash.git/tree/plugin/npapi/callbacks.cpp?id=c12c3cf104a095cff9791cdb3cee8bbf4853d5e0#n631>),
unconditionally parsing the number as `double`
shouldn't cause any problem, as it is same type as JavaScript's `Number`.

Gnash: 0.8.11dev (git c12c3cf 22-Feb-2016)
System: Debian GNU/Linux 7.0 Wheezy i386


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]