Skip to content

Commit

Permalink
fix #507
Browse files Browse the repository at this point in the history
  • Loading branch information
barbibulle committed May 18, 2020
1 parent 17e26f7 commit b4a6fd5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Source/C++/Core/Ap4CttsAtom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,20 @@ AP4_CttsAtom::AP4_CttsAtom(AP4_UI32 size,
m_LookupCache.sample = 0;
m_LookupCache.entry_index = 0;

if (size < AP4_FULL_ATOM_HEADER_SIZE + 4) {
return;
}

// read the number of entries
AP4_UI32 entry_count;
stream.ReadUI32(entry_count);

// check that there's enough data
if (((size - AP4_FULL_ATOM_HEADER_SIZE - 4) / 8) < entry_count) {
return;
}

// read the entries
m_Entries.SetItemCount(entry_count);
unsigned char* buffer = new unsigned char[entry_count*8];
AP4_Result result = stream.Read(buffer, entry_count*8);
Expand Down

0 comments on commit b4a6fd5

Please sign in to comment.