Closed Bug 558863 Opened 15 years ago Closed 14 years ago

in operator on bytearray throws exception for non-natural number

Categories

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

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED
Q3 11 - Serrano

People

(Reporter: pnkfelix, Assigned: pnkfelix)

References

Details

Attachments

(2 files, 6 obsolete files)

The expression (x in b) where b is a ByteArray object and x is not a nonnegative integer throws an Exception. The Exception is a ReferenceError complaining that the Property is not found and has no default value. The attached file illustrates some of these cases. My hypothesis is that this is an artifact of hasAtomProperty being implemented in terms of getAtomProperty (and assuming getAtomProperty will not throw an exception).
bug 458419 seems eerily similar; it probably suggests a fix.
This is simpler than Erik Tierney's fix to VectorClass (see http://hg.mozilla.org/tamarin-redux/rev/255af38d8bd4 ) as that called out to a special getVectorIndex method for reasons that are currently unclear to me. So it could be that something more complicated is necessary here. Or it could be that the VectorClass code may be simplified in the same way.
Assignee: nobody → fklockii
Also, Mike Morearty warned me that there is duplicate code for ByteArrayGlue.cpp in the flash player source repository, and that needs to be kept in sync with the code here. He pointed me at: //depot/main/FlashRuntime/Main/code/flash/avmglue in perforce I assume an analogous patch there would be straight-forward.
Finally, tharhood pointed out that due to lack of API versioning, we may not be able to fix this bug in this release. I'm not sure at what level of the API needs to stay consistent; certainly Flash 10.0 exhibits a similar bug. (Flash 10.0 cannot run the attached test case but it is easy to rewrite it to use the writeByte method instead of a setter to construct the initial byte array.)
Status: NEW → ASSIGNED
Flags: flashplayer-qrb+
Flags: flashplayer-needsversioning+
Priority: -- → P3
Target Milestone: --- → flash10.2
Updated the test case to work in Strict mode. (Today I learned that Actionscript does not overload the XOR ^ operator to work on Booleans.)
Attachment #438534 - Attachment is obsolete: true
Depends on: 535770
Attached patch avoid exn throws for bytearray in op, versioned (obsolete) (deleted) — Splinter Review
(should this go to Ed instead, Steven? Or someone else? Let me know.)
Attachment #438583 - Attachment is obsolete: true
Attachment #471521 - Flags: review?(stejohns)
Attached patch regression test (obsolete) (deleted) — Splinter Review
(ditto; let me know if someone else is better to review.)
Attachment #470868 - Attachment is obsolete: true
Attachment #471522 - Flags: review?(stejohns)
Comment on attachment 471521 [details] [diff] [review] avoid exn throws for bytearray in op, versioned Nit: Edwin has requested that for new code, we prefer a positive bug test, ie if (bugzillaXXX) // fixed code else /// old busted code rather than if (!bugzillaXXX) // old busted code else // fixed code otherwise, looks fine
Attachment #471521 - Flags: review?(stejohns) → review+
Comment on attachment 471521 [details] [diff] [review] avoid exn throws for bytearray in op, versioned BTW, note that Flash/AIR currently have a similar-but-not-identical version of ByteArray hosted in their own glue code; this patch will have to land there too. (We are way overdue to unify the two...)
Comment on attachment 471522 [details] [diff] [review] regression test I think we are preferring the USE_BUGCOMPAT (or is it USE_SWFVERSION) approach for all new tests of this sort, rather than avm_args. Otherwise looks fine. (Err, except for the commented-out "trace", which probably should be nuked.)
Attachment #471522 - Flags: review?(stejohns) → review-
Comment on attachment 471522 [details] [diff] [review] regression test I think we are preferring the USE_BUGCOMPAT (or is it USE_SWFVERSION) approach for all new tests of this sort, rather than avm_args. Otherwise looks fine. (Err, except for the commented-out "trace", which probably should be nuked.)
(In reply to comment #11) > Comment on attachment 471522 [details] [diff] [review] > regression test > > I think we are preferring the USE_BUGCOMPAT (or is it USE_SWFVERSION) approach > for all new tests of this sort, rather than avm_args. Hmm, could have sworn I tried that and it did not work (which I admit was disturbing). Will try again later today.
Attached patch avoid exn throws for bytearray in op, versioned (obsolete) (deleted) — Splinter Review
Revised to address nit posed by Stephen (about whether if-test should use !bz or bz). Prior version used control-flow to avoid indentation drift, but I don't really have a preference between the two variants, so I'll go with the flow here.
Attachment #471521 - Attachment is obsolete: true
Comment on attachment 477984 [details] [diff] [review] avoid exn throws for bytearray in op, versioned (it was r+'d by stejohns before the nit-fix, btw.)
Attached patch regression test (deleted) — Splinter Review
revised to use USES_SWFVERSION keyword. Not sure what was wrong for me before (maybe I was doing USES_BUGCOMPAT). Seems to work; will fire off a smoke-test shortly.
Attachment #471522 - Attachment is obsolete: true
Attachment #477988 - Flags: review?(stejohns)
prior attachment was erroneous (was old patch that did not yet address the nit). This is the one I was talking about in comment 13.
Attachment #477984 - Attachment is obsolete: true
Attachment #477992 - Flags: review+
Attachment #477988 - Flags: review?(stejohns) → review+
pushed TR: http://hg.mozilla.org/tamarin-redux/rev/9350e38c5e53 (missing the domain from my email address, oops; artifact of reusing old patches without sufficient "hg qrefresh" magic.)
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Flags: flashplayer-bug+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: