diff --git a/Source/C++/Core/Ap4StsdAtom.cpp b/Source/C++/Core/Ap4StsdAtom.cpp index e7097262..68f4a047 100644 --- a/Source/C++/Core/Ap4StsdAtom.cpp +++ b/Source/C++/Core/Ap4StsdAtom.cpp @@ -87,6 +87,7 @@ AP4_StsdAtom::AP4_StsdAtom(AP4_UI32 size, AP4_AtomFactory& atom_factory) : AP4_ContainerAtom(AP4_ATOM_TYPE_STSD, size, false, version, flags) { + if (size < AP4_FULL_ATOM_HEADER_SIZE + 4) return; // read the number of entries AP4_UI32 entry_count; stream.ReadUI32(entry_count);