From aba75e2184c5fae60adf9b370de9bd84788a2ad9 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 5 Jul 2022 13:44:44 -0700 Subject: [PATCH] [FLAC Decoder] Safety decoding for tag reader Use tag string encoding guessing for tag decoding, just in case there are invalid files with non-standard encoded strings inside the tags, or if there are streams with such tags. We don't want any crashes. Signed-off-by: Christopher Snowhill --- Plugins/Flac/FlacDecoder.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Flac/FlacDecoder.m b/Plugins/Flac/FlacDecoder.m index 58add1e7f..221534823 100644 --- a/Plugins/Flac/FlacDecoder.m +++ b/Plugins/Flac/FlacDecoder.m @@ -241,8 +241,8 @@ void MetadataCallback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMeta char *_name; char *_value; if(FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair(vorbis_comment->comments[i], &_name, &_value)) { - NSString *name = [NSString stringWithUTF8String:_name]; - NSString *value = [NSString stringWithUTF8String:_value]; + NSString *name = guess_encoding_of_string(_name); + NSString *value = guess_encoding_of_string(_value); free(_name); free(_value); name = [name lowercaseString];