0001-libaudtag-Verify-tag-length-info-against-decoder-len.patch
src/libaudtag/id3/id3-common.c | ||
---|---|---|
114 | 114 |
str_unref (text); |
115 | 115 |
} |
116 | 116 | |
117 |
/* associate_int for FIELD_LENGTH which sanity checks the length */ |
|
118 |
void id3_associate_length (Tuple * tuple, const char * data, int size) |
|
119 |
{ |
|
120 |
char * text = id3_decode_text (data, size); |
|
121 |
int decoder_length, tag_length; |
|
122 | ||
123 |
if (text && atoi (text) >= 0) { |
|
124 |
decoder_length = tuple_get_int (tuple, FIELD_LENGTH); |
|
125 |
tag_length = atoi (text); |
|
126 | ||
127 |
/* If the decoder has already set an (approximate) length, use it to |
|
128 |
* verify the length from the tag, as that is sometimes bogus */ |
|
129 |
if (decoder_length <= 0 || |
|
130 |
(tag_length > (decoder_length / 2) && |
|
131 |
tag_length < (decoder_length * 2))) |
|
132 |
tuple_set_int (tuple, FIELD_LENGTH, atoi (text)); |
|
133 |
} |
|
134 | ||
135 |
str_unref (text); |
|
136 |
} |
|
137 | ||
117 | 138 |
void id3_decode_genre (Tuple * tuple, const char * data, int size) |
118 | 139 |
{ |
119 | 140 |
char * text = id3_decode_text (data, size); |
src/libaudtag/id3/id3-common.h | ||
---|---|---|
25 | 25 | |
26 | 26 |
void id3_associate_string (Tuple * tuple, int field, const char * data, int size); |
27 | 27 |
void id3_associate_int (Tuple * tuple, int field, const char * data, int size); |
28 |
void id3_associate_length (Tuple * tuple, const char * data, int size); |
|
28 | 29 |
void id3_decode_genre (Tuple * tuple, const char * data, int size); |
29 | 30 |
void id3_decode_comment (Tuple * tuple, const char * data, int size); |
30 | 31 |
void id3_decode_rva (Tuple * tuple, const char * data, int size); |
src/libaudtag/id3/id3v22.c | ||
---|---|---|
249 | 249 |
id3_associate_string (tuple, FIELD_DATE, data, size); |
250 | 250 |
break; |
251 | 251 |
case ID3_LENGTH: |
252 |
id3_associate_int (tuple, FIELD_LENGTH, data, size);
|
|
252 |
id3_associate_length (tuple, data, size);
|
|
253 | 253 |
break; |
254 | 254 |
case ID3_FUCKO_ARTIST: |
255 | 255 |
case ID3_ARTIST: |
src/libaudtag/id3/id3v24.c | ||
---|---|---|
653 | 653 |
id3_associate_string (tuple, FIELD_DATE, data, size); |
654 | 654 |
break; |
655 | 655 |
case ID3_LENGTH: |
656 |
id3_associate_int (tuple, FIELD_LENGTH, data, size);
|
|
656 |
id3_associate_length (tuple, data, size);
|
|
657 | 657 |
break; |
658 | 658 |
case ID3_ARTIST: |
659 | 659 |
id3_associate_string (tuple, FIELD_ARTIST, data, size); |
660 |
- |