"super" allows to access a property in the class of the instance (inexistant in super classes)

Bug #890253 reported by Vincent M.
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Lightspark
New
Undecided
Matthias Gehre

Bug Description

The following code allows to access to the variable x with lightspark whereas no variable x exists in the super class of B1 (A1):

package{
 import flash.display.Sprite;
 public class SuperTest extends Sprite{
        public function SuperTest(){
               var a = new B1();
        trace(a.getSuperX()) // 1000 with lightspark, Error #1069: Property x not found on Super.as$30.A1 with FP10
        }
 }
}

class A1 { }

class B1 extends A1 {

     var x = 1000
     public function getSuperX(){
          return super.x;
     }

 }

I think the problem could come from the method "getVariableByMultiname" of the line 745 of asobject.cpp since the property is directly searched in the object's properties without cheking if the property is one of the super class. But the code is difficult to read for me because I'm not a C++ developer.

This code was compiled with the following command line (SuperTest.zip is attached and contains source and binary):
mxmlc -strict=false -debug -static-link-runtime-shared-libraries=true -output SuperTest.swf -- SuperTest.as

A weird thing is that the code fails too with FP10 if the instance is a subclass of B1, defining:
class C1 extends B1{} // and replacing var a = new B1(); with var a = new C1();

Regarding the AVM2 specification the "getsuper" instruction use "obj" in the operand stack to determine the base class, it seems that, in fact, it uses the base class of the class containing the method definition ...

Revision history for this message
Vincent M. (neovin) wrote :
Revision history for this message
Matthias Gehre (m-gehre) wrote :

So is this a regression against FP10 or does this also fail on FP10?

Changed in lightspark:
assignee: nobody → Matthias Gehre (m-gehre)
Revision history for this message
Vincent M. (neovin) wrote :

I don't really caught the meaning of your question.
The first part of my bug report (before "A weird ...") shows a bug in lightspark implementation regarding the specification of "getsuper", this bug is not present in flash player which is normal.

The second part of my bug report is about a particular case with the "getsuper" instruction, regarding the specification flash player does not comply with it in this particular case. I only test on FP10 and it was just a remark to show that it will not be easy to comply with specification of AVM2 and to comply at the same time with the implementation of the flash player. I am interested if you have comments on this remark since I am trying to understand the semantic of action script bytecode.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.