mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
gst/id3demux/id3v2frames.c: Make sure the ISO 639-X language code in ID3v2 COMM frames so we don't end up with non-UT...
Original commit message from CVS: Based on patch by: Tommi Myöhänen <ext-tommi.myohanen nokia com> * gst/id3demux/id3v2frames.c: (parse_comment_frame): Make sure the ISO 639-X language code in ID3v2 COMM frames is actually valid UTF-8 (or rather: ASCII), so we don't end up with non-UTF8 strings in tags if there's garbage in the language field. Also make sure the language code is always lower case. Fixes: #508291.
This commit is contained in:
parent
90dd96debc
commit
231127100f
2 changed files with 20 additions and 5 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2008-01-09 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
Based on patch by: Tommi Myöhänen <ext-tommi.myohanen nokia com>
|
||||
|
||||
* gst/id3demux/id3v2frames.c: (parse_comment_frame):
|
||||
Make sure the ISO 639-X language code in ID3v2 COMM frames
|
||||
is actually valid UTF-8 (or rather: ASCII), so we don't end
|
||||
up with non-UTF8 strings in tags if there's garbage in the
|
||||
language field. Also make sure the language code is always
|
||||
lower case. Fixes: #508291.
|
||||
|
||||
2008-01-09 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* ChangeLog:
|
||||
|
|
|
@ -225,10 +225,10 @@ parse_comment_frame (ID3TagsWorking * work)
|
|||
return FALSE;
|
||||
|
||||
encoding = work->parse_data[0];
|
||||
language[0] = work->parse_data[1];
|
||||
language[1] = work->parse_data[2];
|
||||
language[2] = work->parse_data[3];
|
||||
language[3] = 0;
|
||||
language[0] = g_ascii_tolower (work->parse_data[1]);
|
||||
language[1] = g_ascii_tolower (work->parse_data[2]);
|
||||
language[2] = g_ascii_tolower (work->parse_data[3]);
|
||||
language[3] = '\0';
|
||||
|
||||
parse_split_strings (encoding, (gchar *) work->parse_data + 4,
|
||||
work->parse_size - 4, &fields);
|
||||
|
@ -250,7 +250,11 @@ parse_comment_frame (ID3TagsWorking * work)
|
|||
sscanf (description, "c%u", &dummy) != 1) {
|
||||
gchar *s;
|
||||
|
||||
if (language[0] != '\0') {
|
||||
/* must be either an ISO-639-1 or ISO-639-2 language code */
|
||||
if (language[0] != '\0' &&
|
||||
g_ascii_isalpha (language[0]) &&
|
||||
g_ascii_isalpha (language[1]) &&
|
||||
(g_ascii_isalpha (language[2]) || language[2] == '\0')) {
|
||||
s = g_strdup_printf ("%s[%s]=%s", description, language, text);
|
||||
} else {
|
||||
s = g_strdup_printf ("%s=%s", description, text);
|
||||
|
|
Loading…
Reference in a new issue