Skip to content

Commit

Permalink
fix #873
Browse files Browse the repository at this point in the history
  • Loading branch information
barbibulle committed Feb 20, 2024
1 parent 66e2922 commit a979915
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Source/C++/Core/Ap4DrefAtom.cpp
Expand Up @@ -73,12 +73,17 @@ AP4_DrefAtom::AP4_DrefAtom(AP4_UI32 size,
AP4_AtomFactory& atom_factory) :
AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, 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);
AP4_Result result = stream.ReadUI32(entry_count);
if (AP4_FAILED(result)) return;

// read children
AP4_LargeSize bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
AP4_LargeSize bytes_available = size - (AP4_FULL_ATOM_HEADER_SIZE + 4);
while (entry_count--) {
AP4_Atom* atom;
while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
Expand All @@ -95,10 +100,8 @@ AP4_DrefAtom::AP4_DrefAtom(AP4_UI32 size,
AP4_Result
AP4_DrefAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;

// write the number of entries
result = stream.WriteUI32(m_Children.ItemCount());
AP4_Result result = stream.WriteUI32(m_Children.ItemCount());
if (AP4_FAILED(result)) return result;

// write the children
Expand Down

0 comments on commit a979915

Please sign in to comment.