From: Lucas De Marchi Date: Wed, 28 Aug 2013 21:45:55 +0000 (-0300) Subject: plugins/id3: Fix id3v2 not skipping CRC if present X-Git-Tag: accepted/tizen/generic/20140106.140339~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fdde5300cde7975ddaebc2cc1e9047f314384bb1;p=platform%2Fupstream%2Flightmediascanner.git plugins/id3: Fix id3v2 not skipping CRC if present If there's a CRC field after the extended header, we need to skip it, too. The worst thing that could happen here is the CRC containing a sync byte and having no other frames in the ID3v2. In this case our parser would not find correct mp3 information. --- diff --git a/src/plugins/id3/id3.c b/src/plugins/id3/id3.c index a5c9c22..8e3a56b 100644 --- a/src/plugins/id3/id3.c +++ b/src/plugins/id3/id3.c @@ -756,16 +756,18 @@ _parse_id3v2(int fd, long id3v2_offset, struct id3_info *info, if (extended_header) { /* skip extended header */ unsigned int extended_header_size; - char extended_header_data[4]; + char extended_header_data[6]; + bool crc; if (read(fd, extended_header_data, 4) != 4) return -1; extended_header_size = _to_uint(extended_header_data, 4); - lseek(fd, extended_header_size - 4, SEEK_CUR); + crc = extended_header_data[5] & 0x8000; - *ptag_size += extended_header_size; + *ptag_size += extended_header_size + (crc * 4); + lseek(fd, extended_header_size - 6, SEEK_CUR); frame_data_pos += extended_header_size; frame_data_length -= extended_header_size; }