Every MP4 file should start with a ftyp box. We rely on that to build a check for magic bytes and return early from the parser.
The problem arises when a file matches the header of a ftyp box but don't actually describe the box correctly -- for instance, bringing a wrong box size. In that case, the box can't be parsed and the file should be discarded.
What happens instead is that, due to an issue with the safe navigation, the parser would still try to read from the missing box, resulting in the error NoMethodError: undefined method[]' for nil:NilClass`.
About the issue
Every MP4 file should start with a
ftyp
box. We rely on that to build a check for magic bytes and return early from the parser.The problem arises when a file matches the header of a
ftyp
box but don't actually describe the box correctly -- for instance, bringing a wrong box size. In that case, the box can't be parsed and the file should be discarded. What happens instead is that, due to an issue with the safe navigation, the parser would still try to read from the missing box, resulting in the errorNoMethodError: undefined method
[]' for nil:NilClass`.