[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 <kode54@gmail.com>
xcode15
Christopher Snowhill 2022-07-05 13:44:44 -07:00
parent c3ca29db0d
commit aba75e2184
1 changed files with 2 additions and 2 deletions

View File

@ -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];