Do not try to open unsupported file versions.

This commit is contained in:
Damiano Galassi committed 2017-10-03 08:02:00 +02:00
1 parent 1c8662d291
commit b42ac4ae14
4 files changed
+15 -1

No files matched your search

+2
View File
@@ -276,12 +276,14 @@
{
self = [super initWithCoder:decoder];
if (self) {
_volume = [decoder decodeFloatForKey:@"volume"];
_channels = [decoder decodeInt64ForKey:@"channels"];
_channelLayoutTag = [decoder decodeInt64ForKey:@"channelLayoutTag"];
_fallbackTrackId = [decoder decodeInt64ForKey:@"fallbackTrackId"];
}
return self;
}
+9 -1
View File
@@ -1246,13 +1246,15 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
#pragma mark - NSSecureCoding
#define MP42FILE_VERSION 5
+ (BOOL)supportsSecureCoding
{
return YES;
}
- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeInt:4 forKey:@"MP42FileVersion"];
[coder encodeInt:MP42FILE_VERSION forKey:@"MP42FileVersion"];
#ifdef SB_SANDBOX
if ([fileURL respondsToSelector:@selector(startAccessingSecurityScopedResource)]) {
@@ -1289,6 +1291,12 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
- (id)initWithCoder:(NSCoder *)decoder {
self = [self init];
NSInteger version = [decoder decodeIntForKey:@"MP42FileVersion"];
if (version < MP42FILE_VERSION) {
return nil;
}
NSData *bookmarkData = [decoder decodeObjectOfClass:[NSData class] forKey:@"bookmark"];
if (bookmarkData) {
BOOL bookmarkDataIsStale;
+2
View File
@@ -412,11 +412,13 @@ static void insertTagsFromStyleRecord(style_record record, NSMutableString *samp
{
self = [super initWithCoder:decoder];
if (self) {
_verticalPlacement = [decoder decodeBoolForKey:@"verticalPlacement"];
_someSamplesAreForced = [decoder decodeBoolForKey:@"someSamplesAreForced"];
_allSamplesAreForced = [decoder decodeBoolForKey:@"allSamplesAreForced"];
_forcedTrackId = [decoder decodeInt64ForKey:@"forcedTrackId"];
}
return self;
}
+2
View File
@@ -366,6 +366,7 @@
{
self = [super initWithCoder:decoder];
if (self) {
_width = [decoder decodeInt64ForKey:@"width"];
_height = [decoder decodeInt64ForKey:@"height"];
@@ -391,6 +392,7 @@
_newProfile = [decoder decodeIntForKey:@"newProfile"];
_newLevel = [decoder decodeIntForKey:@"newLevel"];
}
return self;
}