Check flac magic cookie length

This commit is contained in:
Damiano Galassi committed 2024-08-10 07:00:17 +02:00
1 parent b85f5d59e2
commit ce670fe788
1 file changed
+9 -7
+9 -7
View File
@@ -974,13 +974,15 @@ MP42_OBJC_DIRECT_MEMBERS
}
else if (code == kAudioFormatFLAC || code == kMP42AudioCodecType_FLAC) {
NSMutableData *magicCookie = [NSMutableData dataWithBytes:cookie + 8 length:cookieSizeOut - 8];
uint8_t *bytes = magicCookie.mutableBytes;
bytes[0] = 'f';
bytes[1] = 'L';
bytes[2] = 'a';
bytes[3] = 'C';
return magicCookie;
if (cookieSizeOut > 12) {
NSMutableData *magicCookie = [NSMutableData dataWithBytes:cookie + 8 length:cookieSizeOut - 8];
uint8_t *bytes = magicCookie.mutableBytes;
bytes[0] = 'f';
bytes[1] = 'L';
bytes[2] = 'a';
bytes[3] = 'C';
return magicCookie;
}
}
else if (code == kAudioFormatEnhancedAC3) {