commit 19bd957c24f770daf9871ee30242ea6059aa2e7d
parent 101d08ae9e18a7ac94c4cfcff61d838ba22642d1
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 27 Nov 2010 18:01:46 +0000
fkx
Diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/plugins/id3v23_extractor.c b/src/plugins/id3v23_extractor.c
@@ -136,6 +136,7 @@ EXTRACTOR_id3v23_extract (const unsigned char *data,
char *mime;
enum EXTRACTOR_MetaType type;
size_t off;
+ int obo;
if ((size < 16) ||
(data[0] != 0x49) ||
@@ -285,21 +286,24 @@ EXTRACTOR_id3v23_extract (const unsigned char *data,
if (csize < 5)
return 0; /* malformed */
/* find end of description */
+ obo = data[pos + 14] == '\0' ? 1 : 0; /* someone put a \0 in front of comments... */
+ if (csize < 6)
+ obo = 0;
switch (data[pos + 10])
{
case 0x00:
- word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 15],
- csize - 5, "ISO-8859-1");
+ word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 14 + obo],
+ csize - 4 - obo, "ISO-8859-1");
break;
case 0x01:
- word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 15],
- csize - 5, "UCS-2");
+ word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 14 + obo],
+ csize - 4 - obo, "UCS-2");
break;
default:
/* bad encoding byte,
try to convert from iso-8859-1 */
- word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 15],
- csize - 5, "ISO-8859-1");
+ word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 14 + obo],
+ csize - 4 - obo, "ISO-8859-1");
break;
}
break;