[MAD Decoder] Fix crash on invalid files

The properties function should not be dereferencing an invalid index
into the layer codec name array if layer is not set to 1 through 3. This
could happen if, for instance, an MP3 file has an invalid ID3v2 tag.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-10 02:51:19 -07:00
parent ffdb6262c2
commit 1c9887053c
1 changed files with 1 additions and 0 deletions

View File

@ -756,6 +756,7 @@
}
- (NSDictionary *)properties {
if(layer < 1 || layer > 3) return nil;
const NSString *layers[3] = { @"MP1", @"MP2", @"MP3" };
return @{ @"channels": [NSNumber numberWithInt:channels],
@"bitsPerSample": [NSNumber numberWithInt:32],