Skip to content

Commit

Permalink
fix #840
Browse files Browse the repository at this point in the history
  • Loading branch information
barbibulle committed Feb 17, 2024
1 parent c5874c0 commit c9f5d42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4392,7 +4392,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = NO;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 11.5;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
VALID_ARCHS = "arm64 arm64e i386 x86_64";
Expand Down Expand Up @@ -4434,7 +4434,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 11.5;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx";
VALID_ARCHS = "arm64 arm64e i386 x86_64";
Expand Down Expand Up @@ -4735,6 +4735,7 @@
CA646AF50CE97CEE009699D7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
MACOSX_DEPLOYMENT_TARGET = 11.5;
PRODUCT_NAME = mp4decrypt;
SUPPORTED_PLATFORMS = macosx;
};
Expand All @@ -4743,6 +4744,7 @@
CA646AF60CE97CEE009699D7 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
MACOSX_DEPLOYMENT_TARGET = 11.5;
PRODUCT_NAME = mp4decrypt;
SUPPORTED_PLATFORMS = macosx;
};
Expand Down
9 changes: 8 additions & 1 deletion Source/C++/Core/Ap4TrunAtom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,20 @@ AP4_TrunAtom::AP4_TrunAtom(AP4_UI32 size,
}

int record_fields_count = (int)ComputeRecordFieldsCount(flags);
if (record_fields_count && ((bytes_left / (record_fields_count*4)) < sample_count)) {
if (!record_fields_count) {
// nothing to read
return;
}

if ((bytes_left / (record_fields_count*4)) < sample_count) {
// not enough data for all samples, the format is invalid
return;
}

if (AP4_FAILED(m_Entries.SetItemCount(sample_count))) {
return;
}

for (unsigned int i=0; i<sample_count; i++) {
if (flags & AP4_TRUN_FLAG_SAMPLE_DURATION_PRESENT) {
if (bytes_left < 4 || AP4_FAILED(stream.ReadUI32(m_Entries[i].sample_duration))) {
Expand Down

0 comments on commit c9f5d42

Please sign in to comment.