bugGnash - The GNU Flash player - Bugs: bug #46719, Gnash's `GetVariable()` returns...

 
 

bug #46719: Gnash's `GetVariable()` returns incorrect value of undefined variable under SWF5

Submitter:  Nutchanon Wetchasit <nachanon>
Submitted:  Sat 19 Dec 2015 04:33:41 PM UTC
   
 
Category:  core Severity:  3 - Normal
Release:  master Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 11 Jan 2016 03:04:23 PM UTC, comment #4: 

Patch included, see patch #8851.

`getvariable-allver.html` output before applying the patch:

variable-v5:
variable-v5's string_variable: type=string, value=Hello!
variable-v5's unassigned_variable: type=string, value=undefined
variable-v5's nonexistent_variable: type=object, value=null
variable-v6:
variable-v6's string_variable: type=string, value=Hello!
variable-v6's unassigned_variable: type=string, value=undefined
variable-v6's nonexistent_variable: type=object, value=null
variable-v7:
variable-v7's string_variable: type=string, value=Hello!
variable-v7's unassigned_variable: type=string, value=undefined
variable-v7's nonexistent_variable: type=object, value=null
variable-v8:
variable-v8's string_variable: type=string, value=Hello!
variable-v8's unassigned_variable: type=string, value=undefined
variable-v8's nonexistent_variable: type=object, value=null


You'd see that under SWF5 and SWF6, `undefined` value of `unassigned_variable`
are translated to string "undefined", which is incorrect.

`getvariable-allver.html` output after applied the patch:

variable-v5:
variable-v5's string_variable: type=string, value=Hello!
variable-v5's unassigned_variable: type=string, value=
variable-v5's nonexistent_variable: type=object, value=null
variable-v6:
variable-v6's string_variable: type=string, value=Hello!
variable-v6's unassigned_variable: type=string, value=
variable-v6's nonexistent_variable: type=object, value=null
variable-v7:
variable-v7's string_variable: type=string, value=Hello!
variable-v7's unassigned_variable: type=string, value=undefined
variable-v7's nonexistent_variable: type=object, value=null
variable-v8:
variable-v8's string_variable: type=string, value=Hello!
variable-v8's unassigned_variable: type=string, value=undefined
variable-v8's nonexistent_variable: type=object, value=null


You'd see that output from patched Gnash is identical to output from Flash Player.

Gnash: 0.8.11dev (patched against git 15d61a8 26-Dec-2015)
Flash Player: 11.2 r202 (11.2.202.491) NPAPI binary
Browser: Iceweasel 10.0.12 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>
Mon 11 Jan 2016 02:20:17 PM UTC, comment #3: 

I have also done some more test regarding behavior of `GetVariable()` when
fetching variable from sub-MovieClip loaded from a different SWF file
which uses a different SWF version (e.g. one loaded via `loadMovieNum()`).

Result is Flash Player acts on root movie's SWF version, not the version
of SWF that is loaded as the sub-MovieClip. That is when root movie is SWF7
and sub-movie is SWF5, `GetVariable()` will use SWF7 behavior. When root movie
is SWF5 and sub-movie is SWF7, `GetVariable()` will use SWF5 behavior.

Test file, text output, and screenshot from Flash Player are attached
as `getvariable-extmovie.zip` for reference.

Note: This test code does not work on current Gnash due to path notation
part of bug #42395, which caused `GetVariable()` to fail on sub-MovieClip.

Flash Player: 11.2 r202 (11.2.202.491) NPAPI binary
Browser: Iceweasel 10.0.12 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386


(file #35990)

Nutchanon Wetchasit <nachanon>
Mon 11 Jan 2016 07:36:39 AM UTC, comment #2: 

I have created a new test which checks `GetVariable()` on undefined
(unassigned) and nonexistent variable within SWF version 5-8 under Flash Player:

  • Under SWF 5-6, `undefined` value translates to an empty string.
  • Under SWF 7-8, `undefined` value translates to a string "undefined".


This is consistent to Adobe's documentation regarding `undefined` value
and Gnash's `as_value::to_string()` documentation, and also means that
current automated test must also be corrected so that expected value from
undefined/unassigned variable SWF6 is the same as SWF5.


variable-v5:
variable-v5's string_variable: type=string, value=Hello!
variable-v5's unassigned_variable: type=string, value=
variable-v5's nonexistent_variable: type=object, value=null
variable-v6:
variable-v6's string_variable: type=string, value=Hello!
variable-v6's unassigned_variable: type=string, value=
variable-v6's nonexistent_variable: type=object, value=null
variable-v7:
variable-v7's string_variable: type=string, value=Hello!
variable-v7's unassigned_variable: type=string, value=undefined
variable-v7's nonexistent_variable: type=object, value=null
variable-v8:
variable-v8's string_variable: type=string, value=Hello!
variable-v8's unassigned_variable: type=string, value=undefined
variable-v8's nonexistent_variable: type=object, value=null


Test SWF, source code, build script, HTML container, text output
and screenshot are attached as `getvariable-allver.zip` for reference.

Flash Player: 11.2 r202 (11.2.202.491) NPAPI binary
Browser: Iceweasel 10.0.12 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

(file #35985)

Nutchanon Wetchasit <nachanon>
Sat 26 Dec 2015 02:50:28 PM UTC, comment #1: 

as_value::to_string(version) returns "undefined" for SWF6+ or "" for SWF5 and below. This might be the key to solve this bug (missing to pass the version parameter to to_string?)

Sandro Santilli <strk>
Group Member
Sat 19 Dec 2015 04:33:41 PM UTC, original submission:  

This is a spin-off from bug #42395 (EFF panopticlick GetVariable issue).

As mentioned in bug #42395 comment 16, Flash Player return a value of
unassigned variable or variable with `undefined` value via `GetVariable()`
plugin call as an empty string if the running SWF was targeted to Flash 5.
Current Gnash returns a string "undefined", which is incorrect.

Two automated checks of this behavior on Gnash testsuite are provided in
`extgetvariable_testrunner`, currently giving XFAIL status.
One of them is also the same check used for verifying bug #45840
(timeline unassigned variable issue)'s behavior on SWF5.

Although Gnash's `GetVariable()` implementation could be rigged
to give an empty string under said condition as a stopgap measure,
it might need some testing to check if any specific nature of
`undefined` variable value under SWF5 (and below) caused this behavior,
so the underlying behavior difference (if any) could be fixed.

Note: If SWF version is higher than 5, Flash Player will return
a string "undefined" for such variable; current Gnash followed this correctly.

Gnash: 0.8.11dev (git 4c03566 19-Dec-2015) NPAPI
Adobe Flash Player: 11.2 r202 (11.2.202.491) NPAPI binary
Browser: Iceweasel 10.0.12 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #35990:  getvariable-extmovie.zip added by nachanon (9KiB - application/zip - Test SWF and code to test sub-MovieClip SWF version distinction)
file #35985:  getvariable-allver.zip added by nachanon (6KiB - application/zip - `undefined` GetVariable test Flash file, with source code and screenshots)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by strk (Posted a comment)
  • -email is unavailable- added by nachanon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-01-11 nachanon Attached File- Added getvariable-extmovie.zip, #35990
    2016-01-11 nachanon Attached File- Added getvariable-allver.zip, #35985

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code