Skip to content

Commit

Permalink
fix #952
Browse files Browse the repository at this point in the history
  • Loading branch information
barbibulle committed Apr 27, 2024
1 parent ad05057 commit f6bcd2f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Source/C++/Core/Ap4Stz2Atom.cpp
Expand Up @@ -91,19 +91,21 @@ AP4_Stz2Atom::AP4_Stz2Atom(AP4_UI32 size,
return;
}
AP4_UI32 sample_count;
stream.ReadUI32(sample_count);
if (AP4_FAILED(stream.ReadUI32(sample_count))) {
return;
}

m_FieldSize = field_size;
unsigned int table_size = (sample_count * field_size + 7) / 8;
AP4_UI64 table_size = ((AP4_UI64)sample_count * (AP4_UI64)field_size + 7) / 8;
if (table_size > size - AP4_FULL_ATOM_HEADER_SIZE - 8) {
return;
}
unsigned char* buffer = new unsigned char[table_size];
AP4_Result result = stream.Read(buffer, table_size);
AP4_Result result = stream.Read(buffer, (AP4_Size)table_size);
if (AP4_FAILED(result)) {
delete[] buffer;
return;
}
m_FieldSize = field_size;
m_SampleCount = sample_count;
m_Entries.SetItemCount((AP4_Cardinal)sample_count);
switch (m_FieldSize) {
Expand Down

0 comments on commit f6bcd2f

Please sign in to comment.