Closed Bug 508617 Opened 16 years ago Closed 16 years ago

MethodEnv::initproperty can inappropriately reject const initialization

Categories

(Tamarin Graveyard :: Virtual Machine, defect, P2)

defect

Tracking

(Not tracked)

VERIFIED FIXED
flash10.1

People

(Reporter: stejohns, Assigned: stejohns)

References

Details

Attachments

(1 file, 1 obsolete file)

given: class A { private const foo:Object = new Object(); public function A() { } } class B extends A { public function B() { super(); } } var b:B = new B(); this runs correctly with JIT enabled, but in interp-only mode, fails (incorrectly) with ReferenceError: Error #1074: Illegal write to read-only property foo.as$1:A::foo on foo.as$1.B
something like class A { private const foo:Object public function A() { this["foo"] = new Object() } } could trigger the same failure with JIT enabled, by circumventing early binding in the JIT.
(In reply to comment #1) > something like > > class A > { > private const foo:Object > > public function A() { > this["foo"] = new Object() > } > } > > could trigger the same failure with JIT enabled, by circumventing early binding > in the JIT. maybe, but it doesn't seem to, regardless of jit mode
Attached patch PatchSplinter Review
This patch fixes the misbehavior. (It also deletes some unrelated stale code from MNHT). Note that this might cause previously-function programs to fail.
Assignee: nobody → stejohns
Attachment #393059 - Flags: review?(edwsmith)
Attached patch Testcase (obsolete) — Splinter Review
This patch should be pushed in with the fix. Testcase currently fails with "ReferenceError: Error #1074" when running with -Dinterp
Flags: in-testsuite?
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
Comment on attachment 393185 [details] [diff] [review] Testcase an equivalent testcase is actually already be included in the first patch above. (isn't it?)
Attachment #393185 - Attachment is obsolete: true
Comment on attachment 393185 [details] [diff] [review] Testcase Sorry, didn't even look at the first patch.
Flags: flashplayer-qrb? → flashplayer-qrb+
Priority: -- → P2
Target Milestone: --- → flash10.1
(In reply to comment #3) > > Note that this might cause previously-function programs to fail. Steven, how could this patch cause a failure on previously functioning code? The interpreter code would return an (incorrect) error and the JIT would allow the access. What's the failure situation?
(In reply to comment #7) > (In reply to comment #3) > > > > Note that this might cause previously-function programs to fail. > > Steven, how could this patch cause a failure on previously functioning code? > The interpreter code would return an (incorrect) error and the JIT would allow > the access. What's the failure situation? If the code *expected* an exception to be thrown, and it no longer was, it might fail. (This is a pretty unlikely scenario since it's interp-only, but still...)
Comment on attachment 393059 [details] [diff] [review] Patch looks good and also removes MH_CACHE1 which we discussed recently.
Attachment #393059 - Flags: review?(edwsmith) → review+
pushed as changeset: 2516:d18863e7f76c
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Verified fixed w/ avm 2780; Initial patch also pushed testcase: test/acceptance/misc/bug_508617.as
Status: RESOLVED → VERIFIED
Flags: in-testsuite? → in-testsuite+
(In reply to comment #8) > (In reply to comment #7) > > (In reply to comment #3) > > > > > > Note that this might cause previously-function programs to fail. > > > > Steven, how could this patch cause a failure on previously functioning code? > > The interpreter code would return an (incorrect) error and the JIT would allow > > the access. What's the failure situation? > > If the code *expected* an exception to be thrown, and it no longer was, it > might fail. (This is a pretty unlikely scenario since it's interp-only, but > still...) It is unlikely for plain functions to be interpreted in practice, but it is very likely for init code (global code and class static init code) to be interpreted. so the most likely place to consider for breaking existing code (by suppressing the incorrect exception) would be code that initializes static const class members or global consts.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: