public EOSMovieFixer()
        {
            InitializeComponent();
            Text += " " + Version;

            Instance = this;
        }
Example #2
0
        public EOSMovieFixer()
        {
            InitializeComponent();
            Text += " " + Version;

            Instance = this;
        }
Example #3
0
        private void ParseAtom(InputFile file, ulong position, Atom atom)
        {
            file.Seek(position);
            UInt64 length = file.ReadUInt32(position);

            if (length == 0)
            {
                atom.TotalLength  = file.Length - position;
                atom.HeaderLength = 8;
            }
            else if (length == 1)
            {
                atom.TotalLength  = file.ReadUInt64(position + 8);
                atom.HeaderLength = 16;
            }
            else
            {
                atom.TotalLength  = length;
                atom.HeaderLength = 8;
            }

            if (atom.Type == "mdat")
            {
                if (!IsAtom(GetAtomType(file, position + atom.TotalLength)))
                {
                    EOSMovieFixer.Log("      Buggy [mdat] section (32 bit overflow detected)...");
                    EOSMovieFixer.Log("        Probing [mdat] end...");

                    /* try to find end of mdat by probing next atom */
                    EOSMovieFixer.Log("        length 0x" + atom.TotalLength.ToString("X16"));
                    while (!IsAtom(GetAtomType(file, position + atom.TotalLength)) && ((position + atom.TotalLength) < file.Length))
                    {
                        atom.TotalLength += 0x0100000000;
                        EOSMovieFixer.Log("        length 0x" + atom.TotalLength.ToString("X16"));
                    }

                    if (!IsAtom(GetAtomType(file, position + atom.TotalLength)))
                    {
                        throw new Exception("Could not find 'mdat' end");
                    }
                    else
                    {
                        EOSMovieFixer.Log("      Real atom end found successfully");
                    }
                }
            }

            atom.HeaderFileOffset = position;

            /* save original length for rewriting purposes */
            atom.OriginalPayloadLength     = atom.PayloadLength;
            atom.OriginalPayloadFileOffset = atom.PayloadFileOffset;

            atom.ParsePayload(file, position);
        }