Netflix / photon

Photon is a Java implementation of the Interoperable Master Format (IMF) standard. IMF is a SMPTE standard whose core constraints are defined in the specification st2067-2:2013
Apache License 2.0
234 stars 76 forks source link

MXF parsing: terminate strings on the first null character #373

Open thomasheritage opened 1 week ago

thomasheritage commented 1 week ago

Per SMPTE ST 377-1:2019, a "zero value" can be used to terminate a string.

So, discard any data after the first null character found (if any).

This has the same effect as the implementation for strings in regxmllib at: https://github.com/sandflow/regxmllib/blob/b47b0cdbd6dbf51cae4fb14c3a6a827eb3e0e2cc/src/main/java/com/sandflow/smpte/regxml/FragmentBuilder.java#L902

Note that regxmllib also uses the same readCharacters method for MXF properties with a Type of Type Kind "Character", and allows values of this Type to contain the null character. Photon does not support such "Character" Types (and indeed none have ever been used in MXF according to the SMPTE Metadata Registers). So, no consideration is given to these Types in this patch.

Closes #372