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

ddos in AP4_File::ParseStream #289

Closed
jinyu00 opened this issue Jul 18, 2018 · 0 comments
Closed

ddos in AP4_File::ParseStream #289

jinyu00 opened this issue Jul 18, 2018 · 0 comments
Assignees
Labels

Comments

@jinyu00
Copy link

jinyu00 commented Jul 18, 2018

When open a crafted mp4 file, The program could enter AP4_File::ParseStream , and it could hang on, then program could be not response

void
AP4_File::ParseStream(AP4_ByteStream&  stream,
                      AP4_AtomFactory& atom_factory,
                      bool             moov_only)
{
    // parse top-level atoms
    AP4_Atom*    atom;
    AP4_Position stream_position;
    bool         keep_parsing = true;
    while (keep_parsing &&
           AP4_SUCCEEDED(stream.Tell(stream_position)) && 
           AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream, atom))) {
        AddChild(atom);
        switch (atom->GetType()) {
            case AP4_ATOM_TYPE_MOOV:
                m_Movie = new AP4_Movie(AP4_DYNAMIC_CAST(AP4_MoovAtom, atom), stream, false);
                if (moov_only) keep_parsing = false;
                break;

            case AP4_ATOM_TYPE_FTYP:
                m_FileType = AP4_DYNAMIC_CAST(AP4_FtypAtom, atom);
                break;

            case AP4_ATOM_TYPE_MDAT:
                // see if we are before the moov atom
                if (m_Movie == NULL) m_MoovIsBeforeMdat = false;
                break;
        }
    }
}

The poc

https://gitee.com/hac425/fuzz_data/blob/master/poc.mp4
@barbibulle barbibulle self-assigned this Jul 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants