From 1c9887053c1bfcf62ad80f02d5a266acf762bf37 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 10 Jun 2022 02:51:19 -0700 Subject: [PATCH] [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 --- Plugins/MAD/MADDecoder.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/MAD/MADDecoder.m b/Plugins/MAD/MADDecoder.m index f801fee3d..f46f6e6f8 100644 --- a/Plugins/MAD/MADDecoder.m +++ b/Plugins/MAD/MADDecoder.m @@ -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],