wolfgangw / backports

Deep inspection of digital cinema packages
27 stars 12 forks source link

Overflow in cpl_inspect_xml #79

Open matmat opened 5 years ago

matmat commented 5 years ago

I think that the attached CPL maybe triggers an overflow? Using latest git I get this:

Traceback (most recent call last):
    21: from /usr/local/bin/dcp_inspect:4852:in `<main>'
    20: from /usr/local/bin/dcp_inspect:4604:in `dcp_inspect'
    19: from /usr/local/bin/dcp_inspect:4604:in `each_with_index'
    18: from /usr/local/bin/dcp_inspect:4604:in `each'
    17: from /usr/local/bin/dcp_inspect:4605:in `block in dcp_inspect'
    16: from /usr/local/bin/dcp_inspect:4605:in `each'
    15: from /usr/local/bin/dcp_inspect:4612:in `block (2 levels) in dcp_inspect'
    14: from /usr/local/bin/dcp_inspect:2827:in `cpl_inspect_xml'
    13: from /usr/local/bin/dcp_inspect:2827:in `each_with_index'
    12: from /usr/lib/ruby/vendor_ruby/nokogiri/xml/node_set.rb:203:in `each'
    11: from /usr/lib/ruby/vendor_ruby/nokogiri/xml/node_set.rb:203:in `upto'
    10: from /usr/lib/ruby/vendor_ruby/nokogiri/xml/node_set.rb:204:in `block in each'
     9: from /usr/local/bin/dcp_inspect:2847:in `block in cpl_inspect_xml'
     8: from /usr/lib/ruby/vendor_ruby/nokogiri/xml/node_set.rb:203:in `each'
     7: from /usr/lib/ruby/vendor_ruby/nokogiri/xml/node_set.rb:203:in `upto'
     6: from /usr/lib/ruby/vendor_ruby/nokogiri/xml/node_set.rb:204:in `block in each'
     5: from /usr/local/bin/dcp_inspect:3204:in `block (2 levels) in cpl_inspect_xml'
     4: from /usr/local/bin/dcp_inspect:950:in `new'
     3: from /usr/local/bin/dcp_inspect:950:in `new'
     2: from /usr/local/bin/dcp_inspect:938:in `initialize'
     1: from /usr/local/bin/dcp_inspect:1255:in `validate!'
/usr/local/bin/dcp_inspect:1021:in `validate_atoms!': There can be no more than 99 hours, got 23860 (Timecode::RangeError)

CPL_38d041db-2d7a-494f-a5bc-3d7af894c83b.xml.txt

matmat commented 5 years ago

Hmm.. Furhter investigation seems to indicate wrapped SMPTE subtitles with strange header values (ContainerDuration). Not dcp_inspect's fault, but maybe fail more gracefully?

$ asdcp-info -d -i a50af1ae-137f-44f7-b87b-9d9fec53d787_sub.mxf 
SMPTE 429 file essence type is Timed Text, (2147483647 edit units).
       ProductUUID: 7d836e16-37c7-4c22-b2e0-46a717e84f42
    ProductVersion: 3.5.2
       CompanyName: Fraunhofer IIS
       ProductName: easyDCP Creator+
  EncryptedEssence: No
         AssetUUID: a50af1ae-137f-44f7-b87b-9d9fec53d787
    Label Set Type: SMPTE
         EditRate: 25/1
ContainerDuration: 2147483647
          AssetID: c47359f2-d1f4-4a2b-905c-0735de7d29df
    NamespaceName: http://www.smpte-ra.org/schemas/428-7/2010/DCST
    ResourceCount: 1
    5ea0d087-1fc8-4bbd-afcd-69e13fc16f0a: application/x-font-opentype
matmat commented 5 years ago

And 2147483647 is of course 0x7fffffff, i.e. 31 bits set to "1", so something clearly went wrong when wrapping.

matmat commented 5 years ago

This is a confirmed bug in Easy DCP Creator, fixed in v3.5.5:

bugfix: fixed mismatch of intrinsic duration and mxf ContainerDuration at least in cases where subtitle contained less spots than reel length

Source: https://www.easydcp.com/support-faq.php?id=100

overlookmotel commented 4 years ago

@matmat Thanks for figuring this out and posting the conclusion. I came across a DCP with same problem today and was scratching my head for ages until I came across this issue.

wolfgangw commented 9 months ago

@matmat @overlookmotel you people are awesome.

Yes, issue shall be caught and handled. (Inner inspection of SMPTE TT coming up as well)

overlookmotel commented 8 months ago

@wolfgangw No you are awesome! Brilliant piece of software and have been using it for years to catch all kinds of problems which could have otherwise failed playback in public screenings. Very pleased to see you're back on the case bringing it up to date. Let me know if anything I can do to help.

wolfgangw commented 8 months ago

haha @overlookmotel, I am merely stubborn, alas. Nice to hear that you could put the tool to good use.

Hey, thanks for all the feedback and pr's. Getting these in should become way easier once I'm back up to par.

matmat commented 8 months ago

I agree with @overlookmotel. @wolfgangw you are awesome! Your tools and kindness have helped me immensely throughout the years. It is also you that got me started in understanding the technical details of DCP stuff (and I still don’t get everything).

Really glad you’re back!

wolfgangw commented 8 months ago

Ok stop lol. Really glad to hear that those tools were and are, to some extent, useful to others.