Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec for AMF version 0 omits the use of markers for ecma array and strict array? #30

Open
Coosis opened this issue Nov 19, 2024 · 1 comment

Comments

@Coosis
Copy link

Coosis commented Nov 19, 2024

Hi, i was looking at the spec at https://rtmp.veriskope.com/pdf/amf0-file-format-specification.pdf. I noticed that on page 6, ECMA Array Type is described as associative-count *(object-property), where associative-count is a U32 and object-property is often UTF-8 value-type. That's it. So is the ecma marker just not used? I went and checked some other implementations, they seem to assume there's a marker at the start of serialized data. Same with Strict Array Type. Should the marker be avoided?

@zenomt
Copy link

zenomt commented Nov 23, 2024

the specification seems to have left out the markers to indicate an ECMA Array (ecma-array-marker 0x08) or a Strict Array (strict-array-marker 0x0A). those two collection types start with their corresponding marker byte and then their values are as shown. an unfortunate omission.

also, i see Typed Object section 2.18 shows an incorrect marker (the doc says object-marker instead of typed-object-marker).

finally, i see the heading of each page says "Adobe Systems Incorporated ... AMF 3 Specification" even though this is the AMF 0 specification.

while the AMF 0 specification doesn't say so, i've found that all implementations (including Flash Player) seem to require that an ECMA Array be terminated with an "end of object" object-end-type (UTF-8-empty object-end-marker) just like Object; or in other words, an ECMA Array is serialized just like an Object except that it has a different marker and has a count of how many members it has. implementations including Flash Player will not properly deserialize an ECMA Array if it isn't terminated with an object-end-type. Flash Player seems to set the associative-count to 0 when serializing EMCA Arrays, which means ECMA Arrays are not particularly semantically useful. while there is a separate class in Flash Player for ECMA Array vs Object, in the modern JSON era you would just use Object. i think the intent of ECMA Array is to distinguish an anonymous ActionScript object that you are serializing from an explicit collection object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants