Commit 23112710 authored by Tommi Myöhänen's avatar Tommi Myöhänen Committed by Tim-Philipp Müller
Browse files

gst/id3demux/id3v2frames.c: Make sure the ISO 639-X language code in ID3v2...

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.
parent 90dd96de
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment