db-move: moved libdmapsharing from [testing] to [extra] (x86_64)
[arch-packages.git] / libid3tag / trunk / 11_unknown_encoding.diff
blob7387f2f7d47454db517f5c9be0aea3f415e29639
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 11_unknown_encoding.dpatch by Andreas Henriksson <andreas@fatal.se>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: In case of an unknown/invalid encoding, id3_parse_string() will
6 ## DP: return NULL, but the return value wasn't checked resulting
7 ## DP: in segfault in id3_ucs4_length(). This is the only place
8 ## DP: the return value wasn't checked.
10 @DPATCH@
11 diff -urNad libid3tag-0.15.1b~/compat.gperf libid3tag-0.15.1b/compat.gperf
12 --- libid3tag-0.15.1b~/compat.gperf 2004-01-23 09:41:32.000000000 +0000
13 +++ libid3tag-0.15.1b/compat.gperf 2007-01-14 14:36:53.000000000 +0000
14 @@ -236,6 +236,10 @@
16 encoding = id3_parse_uint(&data, 1);
17 string = id3_parse_string(&data, end - data, encoding, 0);
18 + if (!string)
19 + {
20 + continue;
21 + }
23 if (id3_ucs4_length(string) < 4) {
24 free(string);
25 diff -urNad libid3tag-0.15.1b~/parse.c libid3tag-0.15.1b/parse.c
26 --- libid3tag-0.15.1b~/parse.c 2004-01-23 09:41:32.000000000 +0000
27 +++ libid3tag-0.15.1b/parse.c 2007-01-14 14:37:34.000000000 +0000
28 @@ -165,6 +165,9 @@
29 case ID3_FIELD_TEXTENCODING_UTF_8:
30 ucs4 = id3_utf8_deserialize(ptr, length);
31 break;
32 + default:
33 + /* FIXME: Unknown encoding! Print warning? */
34 + return NULL;
37 if (ucs4 && !full) {